in reply to Using array value (from array ref) as hash key??
Let's try that again. I was on the right track in my first post, but I took a wrong turn.
The problem is with
$monthhash{ @{$months->[$x]} }
$months->[$x]
returns a reference to a array of values (one for each field).
When evaluated in scalar context,
@{$months->[$x]}
returns the number of elements in the dereferenced array. In this case, that means it returns the number of fields (1).
$monthhash{ @{$months->[$x]} }
is therefore the same as
$monthhash{1}
You wanted
$monthhash{ $months->[$x][0] }
Remember, you are dealing with an Array (records) of Array (fields).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using array value (from array ref) as hash key??
by Haddock (Initiate) on May 25, 2007 at 05:54 UTC | |
by ikegami (Patriarch) on May 25, 2007 at 06:08 UTC | |
by Haddock (Initiate) on May 28, 2007 at 00:36 UTC |