in reply to Re: Improper slicing
in thread Improper slicing
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Improper slicing
by japhy (Canon) on Apr 24, 2006 at 15:04 UTC | |
|
Re^3: Improper slicing
by schrodycat (Sexton) on Apr 24, 2006 at 19:05 UTC |