use strict; use Benchmark; my $len = 4000; my @data = (); push(@data,rand()) for (0..$len); timethese(2000, { 'by_whole' => sub { my @copy = sort_by_array(@data); } , 'by_refs' => sub { my @copy = sort_by_ref(\@data); } }); sub sort_by_array { return sort {$a <=> $b} @_; } sub sort_by_ref { return sort {$a <=> $b} @{$_[0]}; } __END__ Benchmark: timing 2000 iterations of by_refs, by_whole... by_refs: 54 wallclock secs (42.80 usr + 0.01 sys = 42.81 CPU) @ 46.72/s (n=2000) by_whole: 44 wallclock secs (43.02 usr + 0.00 sys = 43.02 CPU) @ 46.49/s (n=2000)