|Just another Perl shrine|
Re^2: shift vs @_by radiantmatrix (Parson)
|on Oct 06, 2006 at 14:33 UTC||Need Help??|
I can't easily do my $x, $y = @_; It's valid perl. It assigns a scalar.
Only because the way you called my creates a scalar context. Try my( $x, $y ) = @_;, which creates a list context, and so produces the same result as my $x = $_; my $y = $_;.
This works with any array or list. Check out the difference between:
See, a list in scalar context will give its last element. An array in scalar context will give the number of its elements. However, if we make both sides of the assignment have list context, then elements get copied.
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet