in reply to Abuse of "or next" in expressions and "next" that returns value
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Abuse of "or next" in expressions and "next" that returns value
by vr (Curate) on Jul 19, 2018 at 07:23 UTC |