next is not a function, so does not return a value. Nor does it need to return a value. It is either executed or not. If executed, the expression containing it never gets a chance to use anything next didn't provide. If not executed, then the other subexpression had a non-false value which became the value of the containing expression.
In this case, ${next unless $_;}, if $_ is non-false, the evaluator skips everything to the left of unless, so next isn't executed.
I do agree that ${next unless $_;} is surprising syntax. Still, it is valid and semantically equivalent to $_ or next
In reply to Re: Abuse of "or next" in expressions and "next" that returns value
by RonW
in thread Abuse of "or next" in expressions and "next" that returns value
by vr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |