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

Re: hash within an array within a hash

by Kenosis (Priest)
on Sep 07, 2012 at 01:48 UTC ( #992220=note: print w/ replies, xml ) Need Help??

in reply to hash within an array within a hash

You have the following line in your script:

my $ownersRef = [ $owner1Ref, $owner2Ref ];

A two-element anonymous array is created, and $ownersRef is a reference to it. To get at the element 0 of this array, the arrow operator can be used to deference the array reference:

print $ownersRef->[0]



Element 0 in the anonymous array is a hash reference (and so is element 1). So, to get "Santa Claus" (sounds like a movie plot, doesn't it???!), another arrow operator can be used for dereferencing the hash reference:

print $ownersRef->[0]->{name}; ^ ^ | | | + hash key for "Santa Claus" | + array element 0


Santa Claus

Comment on Re: hash within an array within a hash
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2015-11-28 13:07 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (741 votes), past polls