kansas-city-pm-list  

5.8.0 changes file

david nicol
Thu, 10 Oct 2002 12:22:12 -0700


I don't want to bother perl5-porters with my questions...

> =head2 Modifying $_ Inside for(..)
> 
>    for (1..5) { $_++ }
> 
> works without complaint.  It shouldn't.  (You should be able to
> modify only lvalue elements inside the loops.)  You can see the
> correct behaviour by replacing the 1..5 with 1, 2, 3, 4, 5.

Is there a bug?  There a lots of places where you want to modify $_
within loops.  Consider:

                for (@names){
                        s/\b([a-z])/toupper($1)/g;
                        print;
                }
for one example.


Who says that modifying $_ here causes a problem?  It doesn't
break the looping.  Do they want it break the looping, as in
a for(;;) construction?