the list assignment returns the length of the list in scalar context, so
DB<114> $l = ( @a = qw/a b/ ) => 2

So it's not the same code!

The difference between your code and my example is that there is no explicit variable (like $l) used here, but somehow it's still possible to change it.

Maybe it's a side effect of for ? I dunno.

I'd prefer a Can't modify warning here too!

But it's still a very peculiar construction, so I'm not surprised if this edge case wasn't covered.

HTH!

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

update

More insights:

... it's not the temporary scalar which is modified but the resulting list in brackets

DB<121> print "$_\n" for ($a=666) x= 2 666 666 => "" DB<122> $a => 666

According to the already cited documentation of "combined assignments" this shouldn't be possible, b/c its a list operation.


In reply to Re^3: ... for (@_) x= 2; (scalar assignment) by LanX
in thread ... for (@_) x= 2; by rsFalse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.