in reply to why doesn't "my ($a,$b)" return a list?
my ($a,$b) seems to be handled like a shorthand for my ($a,$b)=(undef,undef)
What my() returns in scalar context (the last value it would normally return in list context) is unrelated to what list assignment returns in scalar context (the count of items returned by its RHS).
>perl -wE"$r = \my ($x,$y,$z); $$r = '!'; say $x; say $y; say $z" Use of uninitialized value $x in say at -e line 1. Use of uninitialized value $y in say at -e line 1. ! >perl -wE"my $c = my ($x, $y, $z) = (undef, undef); say $c" 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: why doesn't "my ($a,$b)" return a list?
by LanX (Saint) on Aug 19, 2010 at 15:01 UTC |