in reply to Re^10: If you believe in Lists in Scalar Context, Clap your Hands
in thread If you believe in Lists in Scalar Context, Clap your Hands
The quote is true. Of course, the only way to return more than one aggregate is to be in list context.
If a flattened list was being returned in the following code, it would print "d" instead of "4".
perl -le"print scalar sub { my @a = qw(a b c d); return (@a,@a) }->(); +"
The only purpose served by the "there's no such thing as a list in a scalar context" meme
So? I'm against it too. Too many definitions of list involved. I've been promoting "an operator/function/sub/expression can't return a list in scalar context".
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^12: If you believe in Lists in Scalar Context, Clap your Hands
by BrowserUk (Patriarch) on Oct 24, 2008 at 20:45 UTC | |
by ikegami (Patriarch) on Oct 24, 2008 at 21:30 UTC |