min#

Return the numerically smallest value in the list.

Synopsis#

my $lo = min @values;
my $lo = min 3, 9, 12;           # 3

What you get back#

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.

Examples#

my $n = min 1..10;               # 1
my $n = min @bar, @baz;          # smallest across concatenated lists
my $n = min();                   # undef

Edge cases#

  • Empty list returns undef.

  • Strings are compared numerically (use minstr for lexical order).

Differences from upstream#

Fully compatible with upstream.

See also#

  • max — the numerical maximum counterpart.

  • minstr — string-wise minimum (lt semantics).

  • reduce — custom minima (e.g. by a key function).