go ahead... be a heretic | |
PerlMonks |
Why use map here? (re: Hash/Array of Regular Expressions?)by bikeNomad (Priest) |
on Jun 24, 2001 at 20:19 UTC ( [id://91073]=note: print w/replies, xml ) | Need Help?? |
Good question. I agree that sometimes map obscures things. However, I find it obscuring when it's used in void context (instead of a foreach loop). However, I also find that using a foreach loop where a mapping is happening obscures things.
I used map because:<bl> option) In Smalltalk, every collection responds to the collect: message, which passes each of the elements of the collecion into a block (equivalent to a Perl CODE ref) whose output is collected into a collection of the same species as the original collection. So Perl's map operator corresponds directly to Smalltalk's collect: methods. Also, Perl's grep operator corresponds directly to Smalltalk's select: methods.
update: changed title because of topic change
In Section
Seekers of Perl Wisdom
|
|