Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^7: Iterating over hash while deleting elements (Best Practice)

by Eily (Monsignor)
on Feb 07, 2020 at 14:11 UTC ( #11112564=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    while (my $key = $remaining_keys->next())
    {
      ...;
    }
    
  2. or download this
    while (my ($key, $value) = delete_first %hash)
    {
      do_stuff(\%hash, $key, $value);
      $subset{$key} = $value if valid($key);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11112564]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2021-12-02 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (23 votes). Check out past polls.

    Notices?