Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://587142]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-19 02:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found