Your line $line="abc.xyz@lmnop.com"; is using double-quotes so you are trying to interpolate the array @lmnop into the string. Use single-quotes to suppress interpolation.
knoppix@Microknoppix:~$ perl -E ' > $line = q{abc.xyz@lmnop.com}; > say $line; > $line =~ s{(?=\@)}{\\}; > say $line;' abc.xyz@lmnop.com abc.xyz\@lmnop.com knoppix@Microknoppix:~$
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: how to substitute '@' in line
by johngg
in thread how to substitute '@' in line
by vishy_acts
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |