in reply to Re^2: a HASH ref while "strict refs" ERROR
in thread a HASH ref while "strict refs" ERROR

You're right

use strict; use warnings; use Benchmark ();
sub test_arr { my @arr = @_; $a = join('|', @arr); } sub test_ref { my @arr = @{$_[0]}; $a = join('|', @arr); } sub test_ref2 { $a = join('|', @_); }
{ my @tiny = qw( abc def ghi ); Benchmark::cmpthese(-3, { arr => sub { test_arr @tiny }, ref => sub { test_ref \@tiny }, ref2 => sub { test_ref2 \@tiny }, }); } { my @small = ('abcdefghi') x 10; Benchmark::cmpthese(-3, { arr => sub { test_arr @small }, ref => sub { test_ref \@small }, ref2 => sub { test_ref2 \@small }, }); } { my @giant = ('abcdefghi') x 1000; Benchmark::cmpthese(-3, { arr => sub { test_arr @giant }, ref => sub { test_ref \@giant }, ref2 => sub { test_ref2 \@giant }, }); } __END__ output ======
TINY ARRAY Rate ref arr ref2 ref 120870/s -- -14% -17% arr 140004/s 16% -- -4% ref2 145146/s 20% 4% -- SMALL ARRAY Rate ref arr ref2 ref 61587/s -- -8% -58% arr 67214/s 9% -- -54% ref2 146895/s 139% 119% -- GIANT ARRAY Rate ref arr ref2 ref 850/s -- -0% -99% arr 850/s 0% -- -99% ref2 148539/s 17383% 17381% --

The arrays would have to be pretty damn big for it to matter if one does my @arr = @_.