my $delim = quotemeta '|'; my $s = 'This is my string that has a | in it.'; $s =~ s/($delim)/\\$1/g; print "$s\n"; __END__ This is my string that has a \| in it.
In reply to Re: How to 'escape' a character in a string?
by toolic
in thread How to 'escape' a character in a string?
by VingInMedina
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |