Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make an if statement to check multiple variables

Status
Not open for further replies.

PhoenixDown

Programmer
Jul 2, 2001
279
CA
I want to make an if statement that will check 5 email addresses. how do i do it? AIM: XCalvin1984
Email: calvin@puremadnezz.com
MSN: xcloud2000x@hotmail.com
Web Site: Yahoo Messenger: xcloud2000x

Contact me for any programming help and whatnot. I'll try my best to help! :)
 
Check 5 email addresses for what? Non-blank? Correctly formed? Do you want to check each of the 5 individually, or all 5 together?

Need input!
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
If you want to make sure that all of them are real email addresses, try this:

Assuming the email addresses are stored in @EmailAddresses, do this:
Code:
for $i (0 .. 4) {
     print "Entry number $i is not an email address!" if ($EmailAddresses[$i] !~ /[\w\.-]+\@[\w-]+\.\w{2,}/);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top