Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Array of hashes

by stephen (Priest)
on Apr 26, 2002 at 03:53 UTC ( #162171=note: print w/ replies, xml ) Need Help??


in reply to Array of hashes

A)Yes, B) Like so:

my @superfriends = ( { name => 'aquaman', power => 'talks to fish' }, { name => 'zan', power => 'can turn into water or ice' }, ); # To access the name of the second superfriend in list print "Name: $superfriends[1]{'name'}\n";
Note: Code not tested, and superfriends powers not double-checked.

Technically, it's an array of hash references, but hey...

stephen


Comment on Re: Array of hashes
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2015-07-06 09:48 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 (71 votes), past polls