Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Checking on multiple email addresses in a string

by wine (Scribe)
on Jul 22, 2001 at 19:45 UTC ( [id://98828]=note: print w/replies, xml ) Need Help??


in reply to Checking on multiple email addresses in a string

I guess you user would seperate their addresses with a space or a comma. I would check on that.

Something like:

#!/usr/bin/perl -w use strict; sub is_single { my $email = shift; # remove spaces from beginning and end $email =~ s/^\s*|\s*$//g; # check for characters invalid in an emailaddress return $email=~/[\s,]/?0:1; } # prints 1 print is_single('hpotter@hotmail.com'); # prints 0 print is_single('hpotter@hotmail.com, mickymouse@disney.com');

But I guess some people around here have a far more beautiful solution.

Update strict-ing the code and making it more verbose

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-29 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found