Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: map vs for\foreach.

by stevieb (Canon)
on Mar 11, 2015 at 14:22 UTC ( [id://1119635]=note: print w/replies, xml ) Need Help??


in reply to map vs for\foreach.

map() is a very powerful transformation tool. If I see map() in code, I know the intent of the code is to do something with each element of the structure passed in. That's not always as easy to spot in a for() loop.

Besides, most map() work is contained on a single line, therefore making the code easier to understand at a glance.

Just my $.02.

-Steve

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1119635]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-20 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found