Any of the answers above are the correct ways to go
about it, but on a side note, I just thought i'd add a
comment about debugging code. It's easy to see from the
original code that the condition if ($emailaddr eq $email)
isn't at fault, so a good thing to do might be to go into
the else and add a statement such as
print "-$emailaddr- ne -$email-\n"
This could be helpful in the beginning before there are too
many email addresses in the database, and the hyphens around
each of the variables could help track down hard to find
differences such as whitespace. If this is a CGI script,
you can instead print to STDERR and check your server's
error log.