http://qs321.pair.com?node_id=315063

hotshot has asked for the wisdom of the Perl Monks concerning the following question:

hello guys!

I have a hash of hashes, for example:
%hash = { abc => { def => 1, }, ghi => { jkl => 1, }, };
What happen if I do:
delete($hash{abc}{def});
am I staying with?:
%hash = { abc => undef, ghi => { jkl => 1, mno => 1, }, };
That was the first question.
My second one is, I'm looping over the hash and delete keys as shown above if fulfilled a condition. If the ansewer to the first question is yes, is there a short way to delete also the first level key ('abc' in the example) when deleted all second level keys under it. In the example, when performing the above delete, i would have like to stay with:?:
%hash = { ghi => { jkl => 1, mno => 1, }, };
Thanks