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).
In reply to Re: Using array value (from array ref) as hash key??
by ikegami
in thread Using array value (from array ref) as hash key??
by Haddock
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |