in reply to Re: Why does exists cause autovivication?
in thread Why does exists cause autovivication?

Let me see ... how many times have I spent time hunting a bug caused by autovivification during my ten years with Perl ... zero. How many times did it save me from code like if($data and $data->{foo} and $data->{foo}{bar} and $data->{foo}{bar}{baz} and $data->{foo}{bar}{baz}{bat}) or

if (!exists($data->{$key}) { $data->{$key} = []; } push @{$data->{$key}}, $new_value;
? Countless.

If you hear about autovivification for the first time it may sound scary, but you do get used to it. And the problems caused by autovivification are few and far apart.