my @sorted = sort { $a <=> $b } @numbers; my $min = $sorted[0]; my $max = $sorted[-1];