Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^9: Validate newline delimited email list

by Beechbone (Friar)
on Jan 13, 2007 at 17:28 UTC ( #594559=note: print w/replies, xml ) Need Help??


in reply to Re^8: Validate newline delimited email list
in thread Validate newline delimited email list

try:
sub trim; ... my ($error) = 0; my @other_addresses = split( /\n/, $email_list ); foreach (@other_addresses) { trim $_; my $ok = Email::Valid->address($_); $error++ if(!$ok); print "address($_) = $ok<br>"; print "error ".$error."<br>"; } $error_message .= "$error Email list contains an invalid email add +ress.<br +>" if ($error > 0); ... sub trim { $_[0] =~ s/^\s+//; $_[0] =~ s/\s+$//; $_[0]; } }

Search, Ask, Know

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2022-06-29 07:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (96 votes). Check out past polls.

    Notices?