|Just another Perl shrine|
Re: list context (iterators)by LanX (Chancellor)
|on Dec 07, 2010 at 00:12 UTC||Need Help??|
in my $x = 10; the = is a scalar assignment which returns the assigned scalar
in my ($y) = 10; the = is a list assignment which returns the number of assigned elementsą
That's a crucial trick for iterators, where returned elements might be false (like 0 , '' or undef).
will work as long as anything (i.e. no empty list) is returned, while
can break if you don't use special magics like "0 but true".
1) in scalar context!