I want to search and replace a string in a file using a perl script and this string contains a special character like $xyz and replace it with a special string but i am currently having issues with it. Can someone please telling me what is going on?
# usage: perl crHtmlFile
$oldlat = "$xyz"; $newstr = "newstring";
$FILE1 = "myfile";
open(FILE1) or die "Could not read from $filename, program halting. $!";
# loop through the input file
# get the current record
# here i want to replace every occurrence of "$xyz" with "newstring" but perl does not find "$xyz" and i suspect its because of the special character $.
$_ =~ s/$oldstr/$newstr/;