Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Parsing an email address

by Corion (Pope)
on Oct 03, 2010 at 12:34 UTC ( #863172=note: print w/ replies, xml ) Need Help??


in reply to Parsing an email address

strict would have prevented you from making the error of writing "User@domain.com". What Perl sees is the array @domain, which is empty and thus interpolates into an empty string. You want to use single quotes:

my $adr = 'User@domain.com'; ...


Comment on Re: Parsing an email address
Select or Download Code
Re^2: Parsing an email address
by fisher (Priest) on Oct 03, 2010 at 13:57 UTC
    ...or, alternatively, put a backslash in front of '@':

    my $adr= "User\@domain.com";

Re^2: Parsing an email address
by halfcountplus (Hermit) on Oct 03, 2010 at 15:11 UTC

    Another thing that might help with this is using an editor with good syntax highlighting for perl -- one which will show special characters like @ when they are used inside double quotes, etc.

    Using an editor which does not have any syntax highlighting for the language you are coding in seems just plain silly.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863172]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (14)
As of 2014-08-29 22:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls