Booger has asked for the wisdom of the Perl Monks concerning the following question:
I came across this statement in the Perl documentation
last cannot be used to exit a block which returns a value such as eval {} , sub {} or do {} , and should not be used to exit a grep() or map() operation.
Does anyone have any explanation as to why I cannot/should not use last to exit a grep() or map() operation?
More to the point, how to I go about exiting a map or grep operation?
Any suggestions or insights into why this is would be greatly appreciated! My greater understanding of map() isn't all that good.
Thanks!
Matt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Ways to control a map() operation
by liverpole (Monsignor) on Jul 15, 2006 at 20:28 UTC | |
|
Re: Ways to control a map() operation
by chromatic (Archbishop) on Jul 15, 2006 at 20:11 UTC | |
by Aristotle (Chancellor) on Jul 16, 2006 at 12:11 UTC | |
|
Re: Ways to control a map() operation
by planetscape (Chancellor) on Jul 16, 2006 at 07:26 UTC | |
|
Re: Ways to control a map() operation
by shmem (Chancellor) on Jul 16, 2006 at 12:27 UTC | |
|
Re: Ways to control a map() operation
by ioannis (Abbot) on Jul 15, 2006 at 20:27 UTC | |
by Aristotle (Chancellor) on Jul 16, 2006 at 12:07 UTC | |
|
Re: Ways to control a map() operation
by betterworld (Curate) on Jul 15, 2006 at 20:23 UTC | |
by Leviathan (Scribe) on Jul 16, 2006 at 07:31 UTC | |
by betterworld (Curate) on Jul 16, 2006 at 11:13 UTC | |
by Leviathan (Scribe) on Jul 16, 2006 at 11:41 UTC | |
by betterworld (Curate) on Jul 16, 2006 at 11:56 UTC | |
| |
by shmem (Chancellor) on Jul 16, 2006 at 12:58 UTC |