Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-11-27 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (180 votes), past polls