Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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). In reply to Re^2: If you believe in Lists in Scalar Context, Clap your Hands
by moritz
|
|