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


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

but there is no general rule for the result of evaluating a list in scalar context.

The general rule is that the last item of the list is returned, but there might be exceptions (as always ...).

The OP mentions that $scalar = 'a' .. 'z' is an error, but that's really a feature of the range operator, not of "list is scalar context".

The only exception I'm aware of is $r = () = 4..5, where the number of items is returned rather than the the last item. But by my definition above that would actually be an array, not a list, because you can assign to it.

Are there cases where something that's unambiguously a list (and not an array) returns anything else than the last item?

(And I'm not talking about functions that are context sensitive via wantarray either).