Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by Eily (Monsignor)
on Feb 07, 2020 at 14:11 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-20 02:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found