Jarkko Hietaniemi writes:
>On Mon, May 06, 2002 at 08:25:11PM -0700, William R Ward wrote:
[...]  To reduce it even farther, one of
>> these works and the other doesn't - try it and see:
>> 
>> perl -e 'for (1..10) { $_++; }'
>> perl -e 'for (1,2,3,4,5,6,7,8,9,10) { $_++; }'
>> 
>> Is this a known bug?
>
>I think perlsyn has had this for a while:
>
>  If any element of LIST is an lvalue, you can modify it by modifying
>  VAR inside the loop.  Conversely, if any element of LIST is NOT an
>  lvalue, any attempt to modify that element will fail.  In other words,
>  the C<foreach> loop index variable is an implicit alias for each item
>  in the list that you're looping over.
>
>That the first one works (as in, "doesn't fail", what it *does*, I
>don't know) is to be considered an accident since I do not see any
>lvalues in either.
>
>But that's a post-5.8.0 issue from my perspective.

It's something that should (IMNSHO) at least be documented as a known
bug.

-- 
William R Ward            [EMAIL PROTECTED]          http://www.wards.net/~bill/
-----------------------------------------------------------------------------
AMAZING BUT TRUE: There is so much sand in northern Africa that if it were
                  spread out it would completely cover the Sahara Desert!

Reply via email to