Hi All,I am trying to replace a string in the below fashion. But the replacement is not happening. Can you help me with this please?$line="sadaasa aafgrwergh aa";$findString="aa";$replaceString="bb"; $line =~ s/$findString/$replaceString/g; I even tried, $line =~ s/($findString)/($replaceString)/g; Thanks
Here is the portion of my code. What I am trying to do is to find a value in a file and replace the value with another value. I see that the code can locate the value to replace but it is not updating the files.foreach $file (@files){ open(DAT, ">$file") || die("Could not open file!");@fileContent=; foreach $line (@fileContent) { if($line =~ m/$findString/) { print LOGFILE "Match found in $file for line ----$line "; print LOGFILE " Replacing text-$findString with text-$replaceString\n"; $line =~ s/$findString/$replaceString/g; } } close(DAT);}