Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^2: Two Range Operator Anomaliesby liverpole (Monsignor) |
on Mar 11, 2009 at 16:25 UTC ( [id://749940]=note: print w/replies, xml ) | Need Help?? |
Thanks, ikegami.
The documentation "The range operator (in list context) makes use of the magical auto-increment algorithm if the operands are strings." didn't quite shed any light on it, as I'm already familiar with the magical auto-increment feature. (But I think hbm got it below, which clarified something that the documenation could possibly use better wording for). As to the second, however, you say the workaround is to use a "modifiable copy":
But why isn't the my that I'm using here:
doing exactly that?? Update: Actually, I see why. Of course, because it's assigning to a modifiable lvalue of the variable. Never mind. But I'm still curious why this:
Doesn't exhibit the same behavior? Is it simply that it doesn't undergo the same optimization step you referred to? s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
In Section
Seekers of Perl Wisdom
|
|