http://www.perlmonks.org?node_id=972114


in reply to Array of hashes misbehaving?

This fixes the problem: ...

Actually, in this particular case, you could also just not initialize the array, i.e. simply say

my @hashes; $hashes[$_]{$_} = 1 foreach (0 .. 9);

and let autovivification do the job.