email validation using perl


Read With Formatting | Free Open Source Tutorials Account

Perl Programming
Thread: email validation using perl


freak_vss
Hi all,
Im new to perl programming. Im working on an email validation program in perl. In this program, the user enters an email address and the program outputs whether the entered email address is valid or not. Im trying to do this using the Regular expression in perl. It will be a great help if any of you guys can please help me as how to structure this regular expression. Thanks a lot.

peoplejunction
if ($email !~ /[\w\-]+\@[\w\-]+\.[\w\-]+/) {
# Not a valid e-mail address. Create error message.
}else{
# Valid e-mail address. Continue...
}

presentationmall
if ($email !~ /[\w\-]+\@[\w\-]+\.[\w\-]+/) {
# Not a valid e-mail address. Create error message.
}else{
# Valid e-mail address. Continue...
}



Thanks for your information.