Gossamer Forum
Home : General : Perl Programming :

How to include uppercase?

Quote Reply
How to include uppercase?
Hi,
I have a postcard script and i want to "ban" a few e-mail addresses. I did it but if i type the address in uppercase then it goes through anyway. How can i fix that?

This is what i did:
if ($input{'address'} =~ /banned\@email.com/) {
print "Sorry, banned e-mail";
exit;
}

Your help would be really appreciated!
Quote Reply
Re: How to include uppercase? In reply to
Try either:

if ($input{'address'} =~ /banned\@email.com/i)

or

if (lc $input{'address'} =~ /banned\@email.com/)

The first method will match ignoring the case, the second method will lowercase the email address before matching.

Hope that helps,

Alex