Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: map {} list or do {} for list?

by LanX (Cardinal)
on Apr 11, 2014 at 14:29 UTC ( #1081974=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    for my $key ( keys %hosts ) {
        if ( $hosts{$key} != $table_count ) {
            delete $hosts{$key};
        }
    }
    
  2. or download this
    while ( my ($key,$value) = each %hosts) {
        delete $hosts{$key}
          if $value != $table_count;
    }
    
  3. or download this
    while (($key, $value) = each %hash) {
        print $key, "\n";
        delete $hash{$key};   # This is safe
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2020-11-24 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?