in reply to Re: Return value from a binding operator?
in thread Return value from a binding operator?
it returns those submatches in list context.
But note that in this particular case, the context of the return statement — void, scalar, or list — is determined dynamically by the subroutine’s caller. Then, within the conditional operator ?:, the context “propagates downward into the 2nd or 3rd argument, whichever is selected.” (Conditional Operator). So if the sub is called in scalar context, and the condition evaluates to true, the regex will return true or false (i.e. 1 or 0) depending on whether it matches. On the face of it, this seems like a very poor design. :-(
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Return value from a binding operator?
by LanX (Saint) on Apr 12, 2013 at 16:57 UTC |