Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Perl oddities (s/// doesn't DWIM in map)

by Roy Johnson (Monsignor)
on Mar 01, 2005 at 20:18 UTC ( #435597=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @new = map { s/foo/bar/; $_ } @old;
    # @old is modified along with @new!
    # should be my @new = map { s/foo/bar/; $_ } map {$_} @old;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2014-07-29 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (217 votes), past polls