s/test/^\#/g
This does not do what you think it does. Try this substitution on its own and think about what you see. Good example data would be
hello test foo thisisjustatest test1 test2 test3
Hint: The right hand side of a regular expression is not magic, it is just a string.
In reply to Re: find & replace a string in perl
by Corion
in thread find & replace a string in perl
by vr786
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |