[ale] perl question with email addresses

Geoffrey lists at serioustechnology.com
Mon Dec 1 15:53:47 EST 2008


Mike Fletcher wrote:
> 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 :).

This is exactly what was happening.  I assumed it was causing a problem, 
whereas the problem was elsewhere in the code.

> 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).

Thanks for the additional solution.

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

Have a good visit. ;)

-- 
Until later, Geoffrey

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
  - Benjamin Franklin


More information about the Ale mailing list