use strict; my $i = 120; my $n = 250000; my $x = {}; my @a; my $j; $#a = $n; # Up front, big malloc/free ... Does it make a difference? #keys %$x = ($i * $n); #$x = {}; while ($n-- > 0) { $x = {}; keys %$x = $i; for ($j = 0; $j < $i; $j++) { $x->{$j} = $j; } push(@a, $x); }