Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- substitution woes
December 21, 2009, 7:14 pm
rate this thread
I want to use substitution to change a variable which contains
so that it instead contains
I've come very close using:
but that gives me
I've tried many ways but can't seem to find the proper syntax. Can
someone assist? I'd be very grateful :)
Re: substitution woes
Perl is not shell. Adding more layers of backslashes randomly is rarely
You want to replace ' with '. The LHS of an s/// is a regex; ' is not
special in regexes; so it doesn't need escaping. The RHS is a
double-quoted string; ' is not special in a double-quoted string but \
is; so you need to escape the \ but not the '.
$COMMENT =~ s/'/\'/g;
- » FAQ 8.28 How can I call backticks without shell processing?
- — Previous thread in » PERL Discussions