Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How to substitute the elements in an array without changing the original array.

by perladdict (Chaplain)
on Dec 01, 2006 at 08:43 UTC ( #587142=note: print w/ replies, xml ) Need Help??


in reply to How to substitute the elements in an array without changing the original array.

hey, if u r trying to replace the strings by using s///operator,the below code will wok fine.

#!/usr/bin/perl -w @a=("sedam","medam","kadam","sadam"); for(@b=@a) { s/dam/lam/; } print "@b\n"; print "@a";


Comment on Re: How to substitute the elements in an array without changing the original array.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-07-28 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (204 votes), past polls