> > + $x = 1 for $[ = 0; > > + pass('optimized assignment to $[ used to segfault in scalar context'); > > + if (($[) = 0) { $x = 1 } > > + pass('optimized assignment to $[ used to segfault in list context'); > > > > Looks like the descriptions of contexts are swapped (i.e. "for" should be > > "list", "if" should be "scalar"). > > No, the first assignment is in scalar context and the second (with > parentheses) is in list context. But the results of the assignments are > taken in list and scalar contexts, respectively, which I suppose is a > little confusing.
I thought "the assignment" is "the = operator". So: "for $[ = 0" is scalar assignment in list context. "if (($[) = 0)" is list assignment in scalar context. Am I wrong? Consider this: 1 for $a + $b The addition is here obviously in list context (although it is, of course, scalar addition).