rsennat has asked for the wisdom of the Perl Monks concerning the following question:
I delete a key/ value pair in the hash like this,Testcase => {'comp' => {'cmd' => {'tc1' => {platform_type => 'all', testsuite_type => 'all', view => 'private'}, 'tc2' => {platform_type => 'all', testsuite_type => 'all', view => 'private'} } } }
But when the value for a key becomes empty, i need to delete that also. How do i delete the key also?delete $hoh{$comp}{$cmd}{$tc1};
But actually for "cmd", value is empty. So I would like to remove that. And obviously, "comp" value is also empty, so that also needs to be removed.Testcase => {'comp' => {'cmd' => {} } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: complete deletion from hash
by wfsp (Abbot) on Nov 24, 2005 at 10:39 UTC | |
by inman (Curate) on Nov 24, 2005 at 10:51 UTC | |
by rsennat (Beadle) on Nov 24, 2005 at 10:44 UTC | |
|
Re: complete deletion from hash
by Perl Mouse (Chaplain) on Nov 24, 2005 at 10:54 UTC |