Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Access to hash ref element

by choroba (Cardinal)
on May 28, 2013 at 17:33 UTC ( [id://1035663]=note: print w/replies, xml ) Need Help??


in reply to Access to hash ref element

The [ at the beginning of the structure means it is an array reference. The following { tells us there is a hash reference inside. Therefore, the following should work:
my $test = $data->[0]->{'name'};

which can be shortened to

my $test = $data->[0]{name};

as arraows after ] and } are optional and simple alphanumeric keys are quoted automatically.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Access to hash ref element
by Anonymous Monk on May 28, 2013 at 17:46 UTC
    That's right! Thanks for it!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found