[ale] perl question with email addresses

Mike Fletcher fletch at phydeaux.org
Mon Dec 1 15:32:16 EST 2008


Geoffrey wrote:
> I know that when you specify an email address in perl you have to escape 
> the @ as in:
>
> $email = "who\@where.com";
>
> My problem is, I've got a cgi perl script that is being passed an email 
> address of the form:  "who at where.com"
>
> For the life of me, I can't figure out how to convert this to 
> "who\@where.com"
>
>   

Seeing as this was already not the problem I'll just comment for 
completeness' sake.

The backwhacking of the @ is only necessary in double quoted ("", qq{}) 
strings because otherwise Perl would attempt to interpolate the contents 
of an array named "@where".  If you have a piece of data that's come 
from another source (e.g. a form submission) the backslash isn't needed 
as it's not going to be processed by Perl again (unless you of course 
run it through some form of eval :).


An alternative if you don't need to interpolate anything else is to use 
a quotelike operator which doesn't do interpolation ('who at where.com' or 
q{who at where.com} for example).

> Fletch where are you buddy??? :)
>
>   
In Florida at the inlaws not checking my list mailbox . . . :)




More information about the Ale mailing list