in reply to Re^2: wantarray - surprise behaviour
in thread wantarray - surprise behaviour

wantarray refers to where the function was called from.
Returns true if the context of the currently executing subroutine is looking for a list value. Returns false if the context is looking for a scalar. Returns the undefined value if the context is looking for no value (void context).
When you call a subroutine, all arguments are sent in list context, thus the way to get the arguments back inside the sub is using the ($arg1, $arg2) = @_;

It's always list context, even if the list only contains a single value.