Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 rifling through the Monastery: (4)
As of 2014-07-12 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (240 votes), past polls