I think the preferred way to do a negative match is with the !~ operator.

if( $email !~ /@/ )

at this point you don't really need to check if $email eq "", because if it
does it will not have an @ in it.

I'm not sure, but you might also have to escape the @.

-----Original Message-----
From: bob ackerman
To: [EMAIL PROTECTED]
Sent: 4/15/02 8:50 PM
Subject: Re: Checking and email address


On Monday, April 15, 2002, at 08:58  PM, Daniel Falkenberg wrote:

> Hello All,
>
> How would I go about checking to see if a variable contains an @
symbol?
>
> $email = "[EMAIL PROTECTED]";
>
> if ($email ne "@" || $email eq "") {
>  print "Please make sure your type your email address in correctly";
> } else {
>   print "All is OK";
> }
>
> Thx,
>
> Dan

well, i got the sense wrong on my original answer.
try
if ( !($email=~/@/) or $email eq '')
.....

regilar expressions are an important part of perl. you might want to
look 
into it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to