On Thu, Nov 26, 2009 at 5:52 AM, Abigail <abigail@abigail.be> wrote:
> I probably missed it, but which bug is being fixed by forbidding to
> modify the iterator in C<< for $iterator (RANGE) >>?
>
C<< for $x (EXPR..EXPR) >> is special (optimised). It *doesn't* use the
range operator. It shouldn't be affected by the patch. (I'll test when I
can.) If we actually use the range operator, you'll see the problem if you
repeat the statment containing the range. For example,
for (1..2) {
for (1 .. 3,@x) {
$_ .= "foo";
say;
}
}
and
for (1..2) {
map {
$_ .= "foo";
say
} 1..3;
}
both output
1foo
2foo
3foo
1foofoo
2foofoo
3foofoo
Thread Previous
|
Thread Next