Quote from perldoc -f each
If you add or delete elements of a hash while you're iterating over it, you may get entries skipped or duplicated, so don't. Exception: It is always safe to delete the item most recently returned by "each()", which means that the following code will work:
while (($key, $value) = each %hash) { print $key, "\n"; delete $hash{$key}; # This is safe }
In reply to Re: Clean out da hash...
by calin
in thread Clean out da hash...
by GaijinPunch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |