http://qs1969.pair.com?node_id=594446

philosophia has asked for the wisdom of the Perl Monks concerning the following question:

This code is supposed to split up a newline delimited list of email addresses, and iterate through each line, using Email::Valid to test each address. It is not working correctly - it seems to be flagging every address as being invalid, even correct addresses.

my ($error) = 0; my (@other_addresses) = split( /\n/, $email_list ); foreach (@other_addresses) { chomp($_); print $_; $error++ unless(Email::Valid->address($_)); } $error_message .= "$error Email list contains an invalid email add +ress.<br>" unless( $error < 1 );