in reply to how to substitute '@' in line
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
|
|---|