|laziness, impatience, and hubris|
Short-circuiting a map list.by BrowserUk (Pope)
|on Oct 07, 2011 at 22:45 UTC||Need Help??|
BrowserUk has asked for the
wisdom of the Perl Monks concerning the following question:
Is there any way to terminate a map statement before the end of the input list?
The map in question would be embedded in a subroutine, so something like:
Yes, I am aware there are other ways of achieving that goal, but it is only an easily understood example of a generic class of problems.
Note. The desire is not just to not return anything more after the condition is met, but to not inspect further either.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.