# x.pl use Benchmark qw(timethese cmpthese); cmpthese( -2, { GrandFather => sub { my $idxMax = 0; $ARGV[$idxMax] > $ARGV[$_] or $idxMax = $_ for 1 .. $#ARGV; $idxMax; }, reisinge => sub { [ sort { $ARGV[$b] <=> $ARGV[$a] } 0..$#ARGV ]->[0]; } } ); #### $ perl x.pl $(seq 1 1000) Rate reisinge GrandFather reisinge 3742/s -- -3% GrandFather 3864/s 3% -- $ perl x.pl $(seq 1 10000) Rate reisinge GrandFather reisinge 377/s -- -5% GrandFather 395/s 5% -- $ perl x.pl $(seq 1 100000) Rate reisinge GrandFather reisinge 34.1/s -- -18% GrandFather 41.6/s 22% --