in reply to Re^3: Problem with Pattern matching and substitution using variables
in thread Problem with Pattern matching and substitution using variables
Thank you. That solved the issue. Following is the code i am using.
my $data = '#define MANUFACTURER "xyz"'; my $replace = '#define MANUFACTURER(\s+)"xyz"'; my $replace_with = '#define MANUFACTURER$1"abcd"'; my $tmp_str = '$data =~ s/$replace/'.$replace_with.'/g'; eval $tmp_str; print "\n",$data;
Note: The code takes the same approach as kennethk suggested, except that i didn't want the extra qoutes (and escaping of quotes) in $replace_with variable.
|
|---|