Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 chilling in the Monastery: (4)
As of 2014-11-27 05:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (180 votes), past polls