The stupid question is the question not asked | |
PerlMonks |
Re^4: unexpected modify hash in a distance with grep { $_ } (inconsistent behaviour of aliasing)by LanX (Saint) |
on Dec 20, 2019 at 22:57 UTC ( [id://11110461]=note: print w/replies, xml ) | Need Help?? |
> Personally I don't like like this behaviour much, but it was added in 5.004, before my time as a p5 porter Which of both? I personally find the behaviour of the sub arg aliasing far less surprising. The other behaviour rather looks like sacrificing logic for performance or easier code logic. I suppose changing that might be too expensive now, but most code doesn't try to assign to $_ in a loop. If we are going to keep this behaviour, we'll need to document it properly. Something like loop aliasing always triggers autovivification
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|