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

Looks to me that this line

$error++ if(!$ok);

is merely testing whether $ok exists, which it always does according to the line above it.

my $ok = Email::Valid->address($_);

Try testing for the value of $ok that was returned instead.

if ($ok == 1) {#the rest of your code } else {# code here too if you like }