I suggest you read up on regular expressions in Perl. You can use the match operator (m/) to match a specific pattern. The pattern is a regular expression you create. Search the web & you'll find tons of resources, but be patient. It takes a little study to get the hang of it.
Just to give you an example, here's some code I wrote to verify if an email addres has the proper format, and has a specific domain. Sorry I don't have any code handy for your specific problem. If you find yourself in a jam, drop me an e-mail and I'll write you some code. gjn4b9@mizzou.edu
sub verify_mu_email_address
{
#Split the address in order to...
my ($front, $back) = split(/@/, $email);
#...get the length of the first part.
my $allChars = length($front);
#Try to match pattern.
if ($email =~ m/[\w]{$allChars}\@mizzou\.edu$/i)
{
return "TRUE"; #It matched.
}
else
{
return "FALSE"; #Didn't match.
}
}
Good luck,
Greg
_______________________________________
Constructed from 100% recycled electrons
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.