use Benchmark; # Get 200 random 4-digit integers my @array = (grep {/\d{4}/} map { 10000 * (sprintf "%0.4f", rand) } (1..400))[1..200]; print "N = " . @array . "\n\n"; # Be sure we have the right sample size timethese(0, { sorty => \&sorty, space => \&spaceship, comp => \&comp }); sub sorty { sort @array } sub comp { sort {$a cmp $b} @array } sub spaceship { sort {$a <=> $b} @array }