good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^2: Pushing hash ref onto array refby Fletch (Bishop) |
on Apr 12, 2021 at 05:08 UTC ( [id://11131120]=note: print w/replies, xml ) | Need Help?? |
I'd use push @{ $hash->{'key'} }, $new out of habit personally, but if you've got a new enough perl (post 5.24.0 according to perlref; you can use back to 5.20 with a feature declaration) you could use the new postfix deref syntax push $hash->{'key'}->@*, $new instead. Edit: Clarified version requirement.
The cake is a lie.
In Section
Seekers of Perl Wisdom
|
|