Printing e-mail with '\' before '@'??

They have: 117 posts

Joined: Mar 2000

I need to know how to change an e-mail address from [email protected] to yourname\@domain.com. How do I do that?

NOTE: The e-mail address is coming from a form: $FORM{'email'} and is then being printed to a file, if that helps.

Thanks!!

--Edge

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

If you are talking about taking it from a searching through a file and replaceing every occurance of "@" then you run this simple script.

#Script has not been tested so, check for errors that I miss. Sorry.

#!/usr/bin/perl -w
$thefile = "file.txt"

open (FILE, < "$thefile");
@contents = ;
close (FILE);

foreach $line(@contents){
$line =~ s/@//@/; # Don't even know if this will work.
}

Pimpin like a pimp with an electrofied pimpin machine!

They have: 117 posts

Joined: Mar 2000

No, I'm talking about changing it before it even gets printed to the file.

--Edge

They have: 117 posts

Joined: Mar 2000

Nevermind! I figured it out!! Smiling

For anyone who wants to know, just use this little snippet of code:

$FORM{'email'} =~ s/\@/\\\@/g;

Thanks for trying to help, though, VulKen!

--Edge

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Oh..ok. I just returned because I figured out a beter way to do what I was talking about. Now think you can answer my question in the thread below?

VulKen
Hit it long, but keep it short

Pimpin like a pimp with an electrofied pimpin machine!

They have: 568 posts

Joined: Nov 1999

you could replace the "" that you print with to ''
that always works.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.