On Fri, Sep 21, 2001 at 03:16:53AM -0700, Dave Cross wrote:
> After running the following code, what does $i contain (and explain
> your answer).
> $i=1,2;
(spoiler space)
$i contains 1, because it parses as:
($i=1), 2;
What are the other possibilities? If you thought the precedence was
the other way, you'd think it was
$i=(1,2);
in which case $i would end up containing 2.
What's the other erroneous answer? Is it to confuse lists with arrays
_and_ to get the precendence muddled, so that you not only believe
that statements parses as C<$i = (1, 2)> but also believe that the
value of $i will thereby come to be the length of the list on the
RHS?
If that's it, the question could be C<$i=1,3> so that the different
interpretations would all result in different outcomes.