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