http://qs321.pair.com?node_id=449377

TASdvlper has asked for the wisdom of the Perl Monks concerning the following question:

All,

I have a list of email addresses (user@company.com) in a configuration file, what I need to do is replace the "@" with "\@". I've tried regexp but couldn't get it to work, so I'm trying this:

$$email[0] = join('\@', split("@",$$email[0]));
Where $$email[0] is the email address. When I do the above, it actually replaced "@" with "\\@", I've tried:
$$email[0] = join("\\\@", split("@",$$email[0]));
and that doesn't work either. It substitutes "@" with "\\\@". This should be something simple to do, I just can't get a handle on it.

Well, thanks all. All solutions worked, and I actually had it working myself, but because I was printing out my hash table of email addresses using "Dumper" it must have automatically substituted "\@" with "\\@", but if I just print out a single hash element, it looks fine. Urgh ! I just didn't realize the output from using Dumper, looks slightly different. Hate when I do stuff like that.