http://www.perlmonks.org?node_id=719368


in reply to Re^3: If you believe in Lists in Scalar Context, Clap your Hands
in thread If you believe in Lists in Scalar Context, Clap your Hands

One could argue that built-ins like map and grep don't return a list in scalar context, but are context sensitives themselves, so they are not fit for explaining "a list in scalar context". Likewise a regex match with /g.

Replies are listed 'Best First'.
Re^5: If you believe in Lists in Scalar Context, Clap your Hands
by chromatic (Archbishop) on Oct 24, 2008 at 17:31 UTC

    Sure, but you can also argue that 1, 2, 3, isn't a list of values but a list of expressions. Is this a list:

    my $x = ($y = 1), ($z = 2);

    How about this?

    s{\\}{\\\\}g, print

    Or this?

    foo => scalar param( 'foo' )

    It's difficult to tell without seeing the context... which makes me wonder if lists do exist, or if we should talk about the value of expressions instead.