Name

maxstr

Synopsis

maxstr @list
                  

Similar to max, except that maxstr treats all list items as strings. maxstr will return the “highest string” as determined by the gt operator. As always, if list is empty, maxstr returns undef.

my @ll = qw(1 3 5 nate Person pizza man carl_everett dinosaur);
my $max_s = maxstr(@ll);
print "$max_s\n"; # Prints 'pizza'

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.