in reply to Using an array in a hash
The value must be a reference, not an actual array.%LdnLine = ($j => \@check2);
To answer your second question--why does it look right when you print out the entire hash--that's because your array is being treated as a list to initialize the hash. It's not treated as an array value to your key $j; the values in @check2 are used as both keys and values in your hash. This is more clear if you do this:
With my dummy values for @check2 and $j this gave meuse Data::Dumper; print Dumper \%LdnLine;
Which, I'll bet, is not what you were expecting.$VAR1 = { 1 => 'foo', 'bar' => 'baz' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Using an array in a hash
by maverick (Curate) on Aug 08, 2000 at 04:36 UTC | |
by tye (Sage) on Aug 08, 2000 at 07:17 UTC | |
|
RE: Re: Using an array in a hash
by BlaisePascal (Monk) on Aug 08, 2000 at 04:51 UTC |