Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by AnomalousMonk (Bishop)
on Dec 11, 2013 at 10:58 UTC ( #1066597=note: print w/replies, xml ) Need Help??


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

Take a look at Data::Dumper or Data::Dump (and many others of similar nature). Both of these modules define functions that iterate through arbitrarily deeply nested data structures — and they don't even require that they be purely hashes-of-hashes or arrays-of-arrays!

>perl -wMstrict -le "my %ds = ( X => [ { one => 1 }, { two => 2, three => 3 }, ], Y => [ { fee => 'fie' }, { foe => 'fum' }, { foo => 'bar' }, ], ); ;; use Data::Dumper; print Dumper \%ds; " $VAR1 = { 'X' => [ { 'one' => 1 }, { 'three' => 3, 'two' => 2 } ], 'Y' => [ { 'fee' => 'fie' }, { 'foe' => 'fum' }, { 'foo' => 'bar' } ] };

Replies are listed 'Best First'.
Re^2: Dynamically create a foreach loop within a foreach loop?
by choroba (Archbishop) on Dec 11, 2013 at 11:00 UTC
    wrong parent, reap

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-01-28 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (74 votes). Check out past polls.

    Notices?