in reply to Re: Search and replace for @
in thread Search and replace for @

Also, when you populate $string, make sure you use single quotes so @foo is not interpreted as an array variable
$string = 'foo@foo.com'; $string =~ s/\@/\\@/g;