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

Answer: How do I make a hash of arrays?

( #179957=categorized answer: print w/ replies, xml ) Need Help??

Q&A > Data Structures > How do I make a hash of arrays? contributed by Anonymous Monk

my @arrayOne = 1..10; my @arrayTwo = 20..30; my %HashOfArrays = ( one => \@arrayOne ); $HashOfArrays{two} = \@arrayTwo; $HashOfArrays{IpointToTheSameArrayAsOne} = \@arrayOne ; $HashOfArrays{IreferenceTheSameArrayAsOne} = \@arrayOne ; $HashOfArrays{MyValueIsThatOfOneAsWell} = \@arrayOne ;
## to create an array reference, just type \@array
## or [ @array ]
##  [ @array ] does not equal \@array
## see perlref for more info

Comment on Answer: How do I make a hash of arrays?
Select or Download Code
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-12-01 08:26 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (796 votes), past polls