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:
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.$$email[0] = join("\\\@", split("@",$$email[0]));
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Having a problem replacing "@" with "\@"
by Tanktalus (Canon) on Apr 19, 2005 at 19:00 UTC | |
by chas (Priest) on Apr 19, 2005 at 20:29 UTC | |
Re: Having a problem replacing "@" with "\@"
by ambs (Pilgrim) on Apr 19, 2005 at 18:39 UTC | |
Re: Having a problem replacing "@" with "\@"
by sasikumar (Monk) on Apr 19, 2005 at 18:44 UTC | |
Re: Having a problem replacing "@" with "\@"
by Transient (Hermit) on Apr 19, 2005 at 18:40 UTC |
Back to
Seekers of Perl Wisdom