To expand on japhy's post, here is the relevant section from perldata (under "List value constructors"):
In a context not requiring a list value, the value of what appears to be a list literal is simply the value of the final element, as with the C comma operator. For example,assigns the entire list value to array @foo, but@foo = ('cc', '-E', $bar);assigns the value of variable $bar to the scalar variable $foo.$foo = ('cc', '-E', $bar);
Update:
perlop contains information on the comma operator:
Binary "," is the comma operator. In scalar context it evaluates its left argument, throws that value away, then evaluates its right argument and returns that value.
Thanks to japhy for the reminder.
In reply to Re^2: Improper slicing
by bobf
in thread Improper slicing
by schrodycat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |