in reply to Clean out da hash...
Be aware that each keeps state, so adding or deleting elements
in an each loop is not the greatest of ideas. However, your pattern
of usage seems to be supported, though I wouldn't recommend it.
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 Section
Seekers of Perl Wisdom