in reply to Re^2: find & replace a string in perl
in thread find & replace a string in perl
You don't tell us what your input is and what output you get, and how it is different from what you want.
Again, your regular expression still does not do what you may think it does.
$line =~ s/\btest\b/^\#/ig
The right hand side of a regular expression is a simple string.
In Section
Seekers of Perl Wisdom