in reply to Re^3: If you believe in Lists in Scalar Context, Clap your Hands
in thread If you believe in Lists in Scalar Context, Clap your Hands
Perhaps I don't fully understand right associativity.
which I thought meant that the 0..11 would be evaluated in List Context, and then assigned to the lvalues in lists () and ($x, $y) -- the rightmost assignment first. Then the result of that assignment would be assigned to <c>$r and $s this being a scalar assignment. The actual result is that both $r and $s are set to 12. This seems to imply that the first, list, assignment assigns the entirity of (0, 1, ...11) to the intermediate list, irrespective of the number of lvalues it contains. Then the length of that list is assigned to $r. This last step is consistent with the well known Array in Scalar Context... though () doesn't look like an array to me... but I'm willing to believe.
$r = () = 0..11 ;
$s = ($x, $y) = 0..11 ;
assigns $y to $s. But I'm willing to accept that this is quite different from the above. I just don't yet see how.
$s = ($x, $y) ;
As you say, if we then look at:
we find that @r is set to the empty list and @s to the two element list (0, 1). I confess this is more what I expected. The result of the second assignment depends on the result of the first (rightmost).
@r = () = 0..11 ;
@s = ($x, $y) = 0..11 ;
Is it just me ? Is this in fact consistent at some deeper level I don't yet understand ?