Just another Perl shrine | |
PerlMonks |
Re^2: unexpected modify hash in a distance with grep { $_ }by haukex (Archbishop) |
on Dec 20, 2019 at 18:34 UTC ( [id://11110446]=note: print w/replies, xml ) | Need Help?? |
the $_ inside the grep is an alias of the hash-values, i.e. any assignment would be mirrored. For reasons that I don't understand yet (under-coffeination perhaps) this triggers an autovivification. My educated guess is that it's because autovivification generally happens in an lvalue context.
In Section
Seekers of Perl Wisdom
|
|