C:\>perl -e "undef $ref; if (exists $ref->{'key1'}->{'key2'}) {print 'I think i am okay, but...'}; print keys %{$ref}" key1