I have a Perl script that reads regex search and replace values from an INI file.
This works fine until I try to use capture variables ($1 or \1). These get replaced literally with $1 or \1.
Any ideas how I can get this capture functionality to work passing regex bits via variables? Example code (not using an ini file)...
$test = "word1 word2 servername summary message";
$search = q((\S+)\s+(summary message));
$replace = q(GENERIC $4);
$test =~ s/$search/$replace/;
print $test;
This results in ...
word1 word2 GENERIC $4
NOT
word1 word2 GENERIC summary message
thanks