in reply to Forcing Array Context
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Forcing Array Context
by Anonymous Monk on Jun 25, 2003 at 09:36 UTC | |
by broquaint (Abbot) on Jun 25, 2003 at 09:51 UTC |