for(my $i=0; $i < 100000; $i++) { $hash{'foo'.$i} = ''; # using a hash # ${'foo'.$i} = ''; # using dynamic variables } print "done\n"; ; #### #!perl use Benchmark; my %hash; for(my $i=0; $i < 1000; $i++) { $hash{'foo'.$i} = 0; ${'foo'.$i} = 0; } sub useHash { my %hash; for(my $i=0; $i < 1000; $i++) { $hash{'foo'.$i}++; } } sub useVars { my %hash; for(my $i=0; $i < 1000; $i++) { ${'foo'.$i} ++; } } timethese 1000, { useHash => \&useHash, useVars => \&useVars, }; __END__ Benchmark: timing 1000 iterations of useHash, useVars... useHash: 3 wallclock secs ( 2.68 usr + 0.00 sys = 2.68 CPU) @ 372.58/s (n=1000) useVars: 4 wallclock secs ( 3.79 usr + 0.00 sys = 3.79 CPU) @ 264.20/s (n=1000)