Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Dynamically create a foreach loop within a foreach loop?

by ikegami (Pope)
on Dec 11, 2013 at 15:03 UTC ( #1066630=note: print w/ replies, xml ) Need Help??


in reply to Dynamically create a foreach loop within a foreach loop?

use Algorithm::Loops qw( NestedLoops ); my @hashes = ( \%hash0, \%hash1, \%hash2, \%hash3 ); my @key_lists = map [ keys %$_ ], @hashes; NestedLoops(\@key_lists, sub { my @keys = @_; say join ', ' map "$keys[$_] => $hashes[$_]{$keys[$_}}", 0..$#keys; });


Comment on Re: Dynamically create a foreach loop within a foreach loop?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-09-01 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (6 votes), past polls