Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^3: cool way of manipulating array elements

by PrakashK (Pilgrim)
on Sep 13, 2011 at 20:29 UTC ( #925767=note: print w/replies, xml ) Need Help??

in reply to Re^2: cool way of manipulating array elements
in thread cool way of manipulating array elements

I use map, not for its "compact syntax", but depending on the use case. This example, in my opinion, is the perfect use case for map: transform an array using some criteria and return a new array.

for (or, foreach if you like) has its place, but I don't find it inherently more readable than map.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://925767]
[ovedpo15]: maybe even better question is if it possible to pash element to array from left. I mean that the element will enter array[0] and all other elements will move right +1

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2018-03-24 21:24 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (299 votes). Check out past polls.