|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Re: Re: Re: Re: Re: Think for yourself.by tilly (Archbishop) |
| on Oct 30, 2003 at 15:49 UTC ( #303285=note: print w/ replies, xml ) | Need Help?? |
|
I think that you emphasized my point. As I said, To me both grep and map make me start looking for where the return is going because the return is likely to be the point of the operation. Your code example is: I glance at this, and indeed the return is the point of the operation. Just the words, "minutes", "map", "60" and "seconds" makes it blindingly obvious. However it is even more obvious because your code fits a visual pattern that I expect to see. Even a trivial code example with map or grep used for side-effects forces me to think. Compare vs Yeah, both are bad style. But of them, the latter is significantly easier for me to read, and not just because of length. On an unrelated stylistic note, if the contents of a complex mapping become complex, rather than go to a foreach loop, I am inclined to write a function for the body of the map, name it well, and insert it into the map. This emphasizes that the operation is not simple, indicates what it is, and makes it clear that the point of the code is to return something. I find this clearer, YMMV.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||