This is because push expects an array as the first parameter, and because hash values can only hold scalar values you have to dereference the value for push. For more info on dereferencing see. tye's References quick reference and perlreftut.my %hash = ( foo => [ ] ); push @{ $hash{foo} }, "a string"; print $hash{foo}->[0]; __output__ a string
_________
broquaint
In reply to Re: Forcing Array Context
by broquaint
in thread Forcing Array Context
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |