Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
P is for Practical
 
PerlMonks  

Re: Deleting Hash Entries while Iterating

by davido (Cardinal)
on Oct 06, 2003 at 19:05 UTC ( [id://297110]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://297110]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.