perldoc -f exists undef $ref; if (exists $ref->{"Some key"}) { } print $ref; # prints HASH(0x80d3d5c) #### This surprising autovivification in what does not at first--or even second--glance appear to be an lvalue context may be fixed in a future release. #### C:\>perl -e "undef $ref; if (exists $ref->{'key1'}->{'key2'}) {print 'I think i am okay, but...'}; print keys %{$ref}" key1