I have a Perl script that reads a regular expression search and replaces values ββfrom an INI file.
This works fine until I try to use capture variables ($ 1 or \ 1). They are literally replaced with $ 1 or \ 1.
Any ideas how I can get this capture function to work with the transmit bits of a regular expression through variables? Sample code (without using ini file) ...
$test = "word1 word2 servername summary message"; $search = q((\S+)\s+(summary message)); $replace = q(GENERIC $4); $test =~ s/$search/$replace/; print $test;
It leads to...
word1 word2 GENERIC $4
NOT
word1 word2 GENERIC summary message
thanks
source share