>if ( ($fname=~/(\D\S)*/) && > ($lname=~/(\D\S)*/) ) { > > print "<html><head><title></title></head><body >bgcolor='white'><center>Thank You!</center></body></html>"; > >} else { > > print "<html><head><title></title></head><body >bgcolor='white'><center>Sorry but the information was incorrect or >incomplete, please try again.</center></body></html>"; > >} I wasn't going to weigh in, until I saw what others have posted. Ronald Kimball has come the closest so far, but even his example will reject some VALID entries. Supposedly, what you WANT is a first name and a last name composed only of letters, with no spaces or numbers. However, that's somewhat limiting, as I'll explain below. if (($fname =~ /^[A-Za-z]+$/ ) && ($lname =~ /^[A-Za-z]+$/ )) { matches the positive case, of only alphabetic characters, one or more times. Matching the negative case is sometimes briefer: if (($fname =~ /^\D+$/ ) && ($lname =~ /^\D+$/ )) { But this also matches underscores, spaces, and dashes. You may *want* this for names like "Berners-Lee" and "von Neuman". One can also: if (($fname !~ /\d+/ ) && ($lname !~ /\d+/ )) { Which excludes only the POSITIVE case of digits (one or more) in the input strings. I like this, because it's semantically straightforward. However, you need to check too see that the fields are not blank, filled with spaces, etc, if I don't miss my mark. if (($fname !~ /^\s+$|\d+/) && ($lname !~ /^\s+$|\d+/)) { I'm presuming that you've enabled warnings "-w" in the #!, and that you're not passing undefined values of $fname and $lname. If you're not sure, you might also explicitly test for defined(). This code gracefully accepts things like "Berners-Lee" and "van Beethoven", but rejects "Grbphtz9" or " ". Extraterrestrials and nameless entities will just have to look elsewhere. ;-) Okay, now to go slightly off the subject here, just 'cause I could, I've taken your code fragment, added here-documents, prettified the HTML layout, and forced all the tags to uppercase (BBEdit is wonderful!): if (($fname !~ /^\s+$|\d+/) && ($lname !~ /^\s+$|\d+/)) { print <<THANKS; <HTML> <HEAD> <TITLE>Thank You</TITLE> </HEAD> <BODY BGCOLOR='white'> <CENTER> Thank You! </CENTER> </BODY> </HTML> THANKS } else { print <<OOPS; <HTML> <HEAD> <TITLE>Sorry</TITLE> </HEAD> <BODY BGCOLOR='white'> <CENTER> Sorry but the information was incorrect or incomplete, please try again. </CENTER> </BODY> </HTML> OOPS } Ultimately, you should probably move your returned HTML to separate files. Further discussion can go to macperl-anyperl, or macperl-webcgi, whichever is more appropriate. --B # Fungal Parataxonomy Mycology Information (Mycoinfo) # Webmaster, Staff Writer **The World's First Mycology E-Journal** # <mailto:webmaster@mycoinfo.com> <http://www.mycoinfo.com/> # # First they ignore you. Then they laugh at you. Then they fight you. # Then you win. --Mohandas Gandhi ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org