in reply to Why is split faster than anonymous arrays?

I get the array ref faster than the split, though sometimes only marginally so. It appears that you code is incomplete. Here is the code I used:

#!/usr/bin/perl -w use strict; use Benchmark qw(timethese); my $Regexp = qr/,/; sub try_split { my ($arg) = @_; return split $Regexp, $arg; } sub try_arrayref { my ($arg) = @_; return @$arg; } my @arr= '00'..'99'; #my @arr= '0'..'9'; #my @arr= '0'..'3'; my $str= join ",", @arr; my @x; timethese( -3, { split=>sub{@x= try_split($str)}, aref=>sub{@x= try_arrayref(\@arr)} } );
        - tye (but my friends call me "Tye")