Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
RE: Re: Using an array in a hashby maverick (Curate) |
on Aug 08, 2000 at 04:36 UTC ( [id://26708]=note: print w/replies, xml ) | Need Help?? |
Just a bit of elaboration on an excellent post.
The keys and values in hashes can only be scalars, you can't directly store a array as a value. But, you can store a refrence to a array in a hash (a reference is a scalar) which is what btrott's code does. When you want to make a reference to another variable use the \ operator. Or if you don't want to make a variable and then make a reference, you can initialize them this way. The contents can be retrieved like: All this stuff is explained in the o'reily (sp?) books in great detail. I'd suggest getting them. :) /\/\averick
In Section
Seekers of Perl Wisdom
|
|