good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: map versus forby dreadpiratepeter (Priest) |
on Aug 04, 2008 at 14:53 UTC ( [id://702076]=note: print w/replies, xml ) | Need Help?? |
I don't have my best practices in front of me, but.... I don't believe that the tip is for performance, but more for readability and clarity. As a general rule, map is better when doing a transformation, for is better when doing an iteration. Or more simply, use map when generating a result, use for otherwise. -pete "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
In Section
Seekers of Perl Wisdom
|
|