Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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.

Replies are listed 'Best First'.
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?
[Discipulus]: choroba so much work porting from C and the resulting code exceed the 2 sec limit.. ;=(
[Corion]: r@j: But single quotes do not interpolate anything. print $Process; outputs something different than print '$Process';.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (17)
As of 2017-10-23 15:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (280 votes). Check out past polls.

    Notices?