my %hash; print "key foo->bar exists\n" if(exists($hash{foo}) and exists($hash{foo}{bar}));