use Benchmark; $a = shift; $b = shift; print "A = $a\tB = $b\n"; $hash{$_} = $_ for (1..$b); @array[$_] = $_ for (1..$b); sub doSubR { ${$_[0]} = ${$_[0]}} sub doSubV { return $_[0] } timethese ( $a, { '1 Nothing ' => 'for (1..$b) { $trash = $_ };', '2 Mult ' => 'for (1..$b) { $trash = $_ * $_ };', '3 Array ' => 'for (1..$b) { $trash = $array[$_] };', '4 Hash ' => 'for (1..$b) { $trash = $hash{"$_"} };', '5 Sub (Ref)' => 'for (1..$b) { doSubR(\$_); $trash = $_ };', '6 Sub (Val)' => 'for (1..$b) { $trash = doSubV($_) };', });