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


in reply to Strange behaviour reading from hashref stored in array

As moritz says this is auto vivification. There is a way you can test if a key exists without the side effect of creating it

my @a = ( {}, {}, {} ); print $a[3]{foo} if exists $a[3] and exists $a[3]{foo}; # or if you only want to ensure you don't expand @a # print $a[3]{foo} if exists $a[3]; print scalar @a . "\n";

not the most attractive looking code though

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!