in reply to Deleting Hash Entries while Iterating

You may iterate over the hash using each, deleting elements as you go, if you wish. The POD for each says, "You must not add elements to the hash while iterating over it, although you are permitted to use delete."

Update: Please note that different versions of the POD have different comments regarding deleting elements while iterating using each. Camel II says "ok". Earlier versions of the POD say, "don't do it". And the POD for version 5.8.0 says, "It is always safe to delete the item most recently returned by each..."

  • Comment on Re: Deleting Hash Entries while Iterating