my %h; if (exists $h{foo}) {...} # %h is NOT modified. if (exists $h{foo}{bar}) { ...} # $h{foo} is autovivified to be a hash ref # $h{foo}, the hash ref, is empty - $h{foo}{bar} is NOT created.