|more useful options|
Strange aliasing(?) when modifying variable in range operatorby vr (Hermit)
|on Jun 09, 2018 at 16:50 UTC||Need Help??|
vr has asked for the
wisdom of the Perl Monks concerning the following question:
It's not the issue with order of evaluation, but, looks like, some aliasing is going on, when same variable is used on left and right sides, and modified on the right side.
I was trying to be "clever", slicing array and sliding window at the same time, like this:
Maybe I'm wrong and it's not a bug, and there's some logical explanation? Last examples are frightening.
Edit. Corrected the output I expected (thanks, Marshall). Added line numbers to one-liners to refer to them.
Edit 2. But what about the do returning either value (#5, #7) or alias (#4, #6)?
do BLOCK ...Returns the value of the last command in the sequence of commands indicated by BLOCK.