##
my $count = @{$AoA[$i]};
####
use Benchmark 'cmpthese';
my @AoA;
$AoA[42] = [ (1) x 1000 ];
cmpthese(-1,
{
counted => sub {
my $count =0;
foreach my $column (@{$AoA[42]}){
$count ++;
}
},
direct => sub {
my $count = @{$AoA[42]};
},
}
);
__END__
Rate counted direct
counted 11821/s -- -100%
direct 9267717/s 78297% --