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>