hotshot has asked for the wisdom of the Perl Monks concerning the following question:
hello guys!
I have a hash of hashes, for example:
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:?:
I have a hash of hashes, for example:
What happen if I do:%hash = { abc => { def => 1, }, ghi => { jkl => 1, }, };
am I staying with?:delete($hash{abc}{def});
That was the first question.%hash = { abc => undef, ghi => { jkl => 1, mno => 1, }, };
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:?:
Thanks%hash = { ghi => { jkl => 1, mno => 1, }, };
Back to
Seekers of Perl Wisdom