I can access the data in the arrayref returned by the query by using @{$months->$x}, but when I try to use @{$months->$x} as the key for the hash, I get nothing - $monthhash{ @{$months->$x} } which I dont understand.
It has been extensively explained to you, but just to stress it: hash keys are strings. Thus you can't use an array as a key, whether it's an actual array or a dereference of an arrayref. You could use "@array" as a key, but generally there's no need to do that and I don't think it's what you have in mind. OTOH you can take a slice of an hash, but in that case that's
@monthhash{ (@{$months->[$x]}) }
not
$monthhash{ (@{$months->[$x]}) }
I'm more and more convinced of what I wrote!
In reply to Re: Using array value (from array ref) as hash key??
by blazar
in thread Using array value (from array ref) as hash key??
by Haddock
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |