![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: "foreach" is to "next" as "map" is to ???by Belgarion (Chaplain) |
on May 26, 2004 at 16:22 UTC ( [id://356627]=note: print w/replies, xml ) | Need Help?? |
Hmm, I don't think you can exclude something from inside a map, but you could place a grep before the map call. Basically, the grep would remove anything you didn't want before it's passed to the map function. So, you would have something like:
This would pass anything item that matched "good stuff" to the map function for further processing. Update After reading through the other comments posted, I guess I should not be surprised that map is more powerful than I had initially expected. I, personally, happen to think the map/grep combo is clearer code in this example, but the additional power of map is certainly nice to know.
In Section
Seekers of Perl Wisdom
|
|