Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Answer: How do I make a hash of arrays?

by chromatic (Archbishop)
on Apr 01, 2000 at 01:22 UTC ( #6620=categorized answer: print w/replies, xml ) Need Help??

Q&A > Data Structures > How do I make a hash of arrays? - Answer contributed by chromatic

my %dramatis_personae = ( humans => [ 'hamnet', 'shakespeare', 'robyn', ], faeries => [ 'oberon', 'titania', 'puck', ], other => [ 'morpheus, lord of dreams' ], );
Access it like this:
foreach my $group (keys %dramatis_personae) { print "The members of $group are\n"; foreach (@{$dramatis_personae{$group}}) { print "\t$_\n"; } }

Replies are listed 'Best First'.
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2016-12-05 00:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (71 votes). Check out past polls.