"be consistent" | |
PerlMonks |
Re: "foreach" is to "next" as "map" is to ???by sacked (Hermit) |
on May 26, 2004 at 16:27 UTC ( [id://356632]=note: print w/replies, xml ) | Need Help?? |
You can use the empty list () to prevent a return value from an interation of a map block:
Here is (equivalent) code that uses foreach:
Update: As others have stated, if you are not modifying the list, then you should use grep rather than map. Continuing with the code example from above, a better solution would be:
--sacked
In Section
Seekers of Perl Wisdom
|
|