http://www.perlmonks.org?node_id=421051


in reply to Re^2: List assignment in scalar context
in thread List assignment in scalar context

Oh come off it.

sub list { return 1..5 } my ($a,$b,$c); my $n1 = ($a,$b,$c) = list(); my $n2 = my @x = ($a,$b,$c) = list(); print "$n1 ... $n2\n"; ---- 5 ... 3

When you have scalar = list = list, you will always get the count of items in the rightmost list in scalar. In your $n2 example, your array is getting three items from the list. It isn't a scalar, so it isn't getting the count. What else would be expected? The behavior that merlyn is referring to is the reason why you don't see the complete count in the scalar.