Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Accessing data in a Hash of Arrays

by kennethk (Abbot)
on Apr 25, 2013 at 15:01 UTC ( #1030689=note: print w/ replies, xml ) Need Help??


in reply to Accessing data in a Hash of Arrays

print $getConfigurationsResults->{Configuration}[1]{ConfItems}{ConfQty}[0]{ConfItem}{Fuel}{ConfItemName}

or possibly

for my $first (@{$getConfigurationsResults->{Configuration}}) { next unless $first->{ConfItems}; for my $second (@{$first->{ConfItems}{ConfQty}}) { print $second->{ConfItem}{Fuel}{ConfItemName}, "\n"; } }

See perllol.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: Accessing data in a Hash of Arrays
Select or Download Code
Re^2: Accessing data in a Hash of Arrays
by azamatsmith (Initiate) on Apr 26, 2013 at 08:08 UTC

    Thanks Kennethk! This was exactly what I was needing help with and it worked perfectly:

    for my $first (@{$getConfigurationsResults->{Configuration}}) { next unless $first->{ConfItems}; for my $second (@{$first->{ConfItems}{ConfQty}}) { print $second->{ConfItem}{Fuel}{ConfItemName}, "\n"; } }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2015-07-07 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls