CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: can any one tell how to validate correct email address using perl script: Edit Log



aniket
New User

Dec 10, 2009, 6:17 AM


Views: 4388
can any one tell how to validate correct email address using perl script

Can any one tell how to Write a program in perl with the following aim:

- takes an email address as input

- outputs a "valid" or "invalid" - valid if the email address is

valid, and invalid if it is invalid.

- make your own assumptions about what is a valid email addres and what is invalid.

I tried below stuff but didnt worked..please help me:

#!/usr/bin/perl -w

print ("Please type yor email id:\n");

$email = <STDIN>;

if ($email =~ /^(\w\-\_\.)+\@((\w\-\_)+\.)+[a-zA-Z]{2,}$/)

{

print ("$email is valid");

}

else {

print ("$email is invalid");

}





Please help me.


(This post was edited by aniket on Dec 10, 2009, 6:37 AM)


Edit Log:
Post edited by aniket (New User) on Dec 10, 2009, 6:37 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives