Re^4: regexp list return 5.6 vs 5.8by shmem (Chancellor)
|on Jan 24, 2008 at 12:10 UTC||Need Help??|
It is stated in perldata - in parens!
Assignment is a little bit special in that it uses its left argument to determine the context for the right argument. Assignment to a scalar evaluates the right-hand side in scalar context, while assignment to an array or hash evaluates the righthand side in list context. Assignment to a list (or slice, which is just a list anyway) also evaluates the righthand side in list context.
Then there's perlop which states that qw generates a real list at compile time, and returns the last element of that in scalar context (which AFAIK is resolved at runtime). Array slices seem to work the same way (compile time list construction).
But that either
Subroutine return values are evaluated in the caller's context on return, they are not made into a list context on exit which is then evaluated in the caller's context. This is arguably a feature...
Thanks for bringing that up.