Out of curiosity, why does this still work
My understanding of autovivification is that by default it doesn't prevent the dereferencing, it prevents the creation of the new refs (= the autovivification). Compare:
$ perl -MData::Dump -e 'my $x; $x->[0]->{"aaa"}; dd $x'
[{}]
$ perl -MData::Dump -M-autovivification -e \
'my $x; $x->[0]->{"aaa"}; dd $x'
undef
So in the second case $x was not autovivified to an arrayref containing a hashref. If you want the pragma to throw errors, you need to tell it:
$ perl -MData::Dump -M-autovivification=strict,fetch -e \
'my $x; $x->[0]->{"aaa"}; dd $x'
Reference vivification forbidden at -e line 1.
|