Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Iterating over verbatim hash reference

by Ratazong (Monsignor)
on Jan 21, 2010 at 14:17 UTC ( [id://818727]=note: print w/replies, xml ) Need Help??


in reply to Iterating over verbatim hash reference

See Re: Why is "for" much slower than "while"?: by using for instead of while you don't create the hash again in each loop.
HTH, Rata

Replies are listed 'Best First'.
Re^2: Iterating over verbatim hash reference
by rovf (Priest) on Jan 21, 2010 at 14:26 UTC
    I thought about using for, but how do I loop in this way over a hash, so that the key-value association is maintained? Of course I could do something like

    for ([qw(key1 val1)],[qw(key2 val2)],....) { my $key=$_->[0]; my $val=$_->[1]; ... }
    but this too is not quite a response to my original problem, which is, looping over a hash. Or maybe I misunderstood you? Could you give some example?

    -- 
    Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found