use Benchmark; timethese(1000, { 'map1' => sub { my %str = map {($_,1)} (0..1024); }, 'arry' => sub { my %str = (); @str{0..1024} = (1)x1025; } }); Benchmark: timing 1000 iterations of arry, map1... arry: 1 wallclock secs ( 1.36 usr + 0.00 sys = 1.36 CPU) @ 735.29/s (n=1000) map1: 3 wallclock secs ( 3.11 usr + 0.00 sys = 3.11 CPU) @ 321.54/s (n=1000)