in reply to finding the keys with mutliple values in hash and delete them
UPDATE: in the remote past existed caveats about modifying hashes while iterating over them; we are speaking of Perl release prior 5.8 see Adding or removing keys while iterating over a hash Re: Deleting Hash Entries while Iteratingperl -MData::Dumper -e " %h = ('Message2' => [ '0X026007' ], 'Message +4' => [ '0X026005', '0X026006' ] ); foreach $k(keys %h) { delete $h{$k} if defined $h{$k}[1] } print Dumper(\%h) " $VAR1 = { 'Message2' => [ '0X026007' ] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: finding the keys with mutliple values in hash and delete them
by Not_a_Number (Prior) on Mar 19, 2015 at 09:36 UTC | |
|
Re^2: finding the keys with mutliple values in hash and delete them
by kiransmailid (Initiate) on Mar 19, 2015 at 11:01 UTC |