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, }, };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Deleting hash entry
by broquaint (Abbot) on Dec 16, 2003 at 15:05 UTC | |
Re: Deleting hash entry
by talexb (Chancellor) on Dec 16, 2003 at 15:05 UTC | |
by Anonymous Monk on Oct 19, 2012 at 12:57 UTC | |
Re: Deleting hash entry
by tcf22 (Priest) on Dec 16, 2003 at 15:01 UTC | |
Re: Deleting hash entry
by Aragorn (Curate) on Dec 16, 2003 at 15:22 UTC |
Back to
Seekers of Perl Wisdom