in reply to Stepping through a hash while modifiying its content
# Access the hash, and do the deed including any hashkey, value deletions
You should replace that comment with some code :)
You could delay deletion :)
{ my @goners; while( my( $k, $v ) = each %hash ){ push @goners, $k; } delete @hash{ @goners }; undef @goners; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Stepping through a hash while modifiying its content
by Gorgarian (Initiate) on Dec 28, 2012 at 12:19 UTC |
In Section
Seekers of Perl Wisdom