Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Accessing data in a Hash of Arrays

by kennethk (Monsignor)
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: (6)
As of 2014-11-01 04:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (227 votes), past polls