Name

max

Synopsis

max @list
                  

Returns the entry in the list with the highest numerical value. If the list is empty, max returns undef:

my @ll = qw(100 294 2 4 95 73);
my $max_num = max @ll; 
print "$max_num\n"; # Prints '294'

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.