Bill Platt wrote:
> I am trying to validate email addresses.
>
> I have the following code which succeeds in
> most cases:
>
> if ($in{email} !~ /[EMAIL PROTECTED]/i)
>
> If the username part of the email address contains
> either a "." or a "-", this code fails.
>
> Can you tell me why it would fail, and how I could change
> it to make it work for me?
Always submit a complete failing snippet. Seems ok to me:
use strict;
use warnings;
foreach my $email ('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '[EMAIL
PROTECTED]', ) {
if ($email !~ /[EMAIL PROTECTED]/i) {
print "'$email' bad\n";
} else {
print "'$email' good\n";
}
}
__END__
'[EMAIL PROTECTED]' good
'[EMAIL PROTECTED]' good
'[EMAIL PROTECTED]' good
_______________________________________________
Perl-Unix-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs