Each of the subroutine return expressions (i.e., the Operand of the return and any final subroutine expressions) is evaluated in the same context as the subroutine call itself.
sub f { ... return THIS if ...; return THIS if ...; ... if (...) { ... THIS } else { ... THIS } }
In this case, the returned expression is the destination of the list. ( @a and qw are assignment operands and are thus evaluated before assignment.) List assignment in a scalar context is evaluated by the number of elements for which its right-hand side is calculated.
See Scalar vs. List Assignment Operator
source share