$a{foo}{bar} = 'blah'; print "Yep\n" if exists $a{foo} && $a{foo}{bar}; print "Nope\n" if exists $a{bar}{baz}; print "Whoops!\n" if exists $a{bar};