I have a file containing search and replace string in a single line.
And I am reading that file, using split to separate search and replace string and apply it on a variable.
File:
(.*) pre_$1
Perl Code:
$str = "a";
$line = < FILEHANDLE>; # Read above file.Contains (.*) pre_$1
my ($ss,$rs) = split /\s/,$line;
$str =~ s/$ss/$rs/ee;
This seems to be not working.
I tried to look online, one result is close which is wrap the replace string in both single and double quotes.
i.e.:
$rs = '"pre_$1"';
This works if its in the script, but if I read from file I done see any replacement.
Can someone point me to what I am doing wrong here?
Thanks.