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

Re: Arrays & Hashes

by Transient (Hermit)
on Aug 18, 2005 at 18:51 UTC ( #484924=note: print w/replies, xml ) Need Help??


in reply to Arrays & Hashes

No, but you can create a hash of array refs...

see perlref and perlreftut.

Here's an example:
my $hash_of_arrays = { array1 => [ 1, 2, 3 ], array2 => [ 'a', 'b', 'c' ] }; foreach my $key ( %$hash_of_arrays ) { print "Key: $key\n"; foreach my $array_element ( @$key ) { print "Array Element: $array_element\n"; } }
(Untested)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://484924]
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: (4)
As of 2020-05-28 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (166 votes). Check out past polls.

    Notices?