use strict; use Benchmark; my ($x,$i); my @f = ('a'..'zz'); my $f = \@f; sub first_one { for (@f) {$x++} } sub second_one { for (@$f) {$x++} } sub third_one { for ('a'..'zz') {$x++} } sub fourth_one { for ($i=0;$i<=$#f;$i++) {$x++} } timethese(10_000, { 'first' => \&first_one, 'second' => \&second_one, 'third' => \&third_one, 'fourth' => \&fourth_one, });