max#
Return the numerically largest value in the list.
Σύνοψη#
my $hi = max @values;
my $hi = max 3, 9, 12; # 12
Τι επιστρέφεται#
A single number. If every argument is an integer the result is returned as an integer; otherwise it is returned as a float. An empty list yields undef.
Παραδείγματα#
my $n = max 1..10; # 10
my $n = max @bar, @baz; # largest across concatenated lists
my $n = max(); # undef
Οριακές περιπτώσεις#
Empty list returns
undef.Strings are compared numerically (use
maxstrfor lexical order).
Διαφορές από το upstream#
Fully compatible with upstream.
Δείτε επίσης#
min- the numerical minimum counterpart.maxstr- string-wise maximum (gtsemantics).reduce- custom maxima (e.g. by a key function).