in reply to RFC: Context tutorial
In the section Context Clash, you show some interesting effects of assigning a list of expressions separated by commas to a scalar. I was surprised at the results of the third example. (Intuition based on subroutine calls is incorrect because subroutine arguments are in list context.)
However, your statement
Note that an array or hash slice counts as a "list" for this behavior.
does not appear to agree with the perl debugger. I got the following from a quick test:
my @t = qw/one two/; my $y = ( 'larry', 'moe', @t ); print "$y\n"; # prints 2 $y = ( 'larry', 'moe', @t[0,1] ); print "$y\n"; # prints two
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RFC: Context tutorial
by kyle (Abbot) on Jan 13, 2009 at 21:04 UTC | |
by gwadej (Chaplain) on Jan 13, 2009 at 21:24 UTC | |
by kyle (Abbot) on Jan 13, 2009 at 21:45 UTC | |
by ikegami (Patriarch) on Jan 14, 2009 at 01:46 UTC | |
by kyle (Abbot) on Jan 14, 2009 at 03:14 UTC |