Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Acessing an array element in a hash

by OM_Zen (Scribe)
on Mar 26, 2003 at 16:43 UTC ( #245989=note: print w/ replies, xml ) Need Help??


in reply to Acessing an array element in a hash

Hi

The code to populate the hash assuming is like the below , you can access the elements of the array of the hash of the hash like this

my $ascalar = { 'a' => {'a' =>'valueofhashofhash', 'hashinsideahash' => [1, 'secondelementofarrayofsecondhash']}}; print "[$ascalar->{'a'}->{'hashinsideahash'}[0]]\n"; print "[$ascalar->{'a'}->{'hashinsideahash'}[1]]\n"; __END__ [1] [secondelementofarrayofsecondhash]



Comment on Re: Acessing an array element in a hash
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (16)
As of 2015-07-29 18:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls