Arun said:
Hi,
I want to introduce a special character ( \ ) in a string using perl script.
(i.e) "(e-mail address removed)" has to be converted into "first.last\@mail.com".
Please help me.
The answer depends upon the question:
Why would you need it?
If you need it because perl complains about "Possible unintended
interpolation of @mail in string", then just insert the backslash
character using your favorite editor.
If you _think_ you need the backslash because the @ is a special
character and you _think_ that perl might get confused: it won't. If you
read "(e-mail address removed)" from some place (e.g. STDIN, some file), then
the @ won't be regarded as a special character any more. Introducing a
backslash will only introduce one more character, a character you don't
really want.
If you still are convonced you need the backslash:
$s = '(e-mail address removed)';
$s =~ s/\@/\\$&/;
HTH,
Josef