in reply to Re^7: Validate newline delimited email list
in thread Validate newline delimited email list
gives mesub trim; ... my ($error) = 0; my @other_addresses = map trim, split( /\n/, $email_list ); foreach (@other_addresses) { 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 { my ($s) = @_; for ($s) { s/^\s+//; s/\s+$//; return $_; } }
it looks like $_ is not getting populated with an email address.address() = error 1 address() = error 2 There was an error with your form submission. 2 Email list contains an invalid email address.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Validate newline delimited email list
by Beechbone (Friar) on Jan 13, 2007 at 17:28 UTC |