From: "John W. Krahn" <[EMAIL PROTECTED]>
Aaron Reist wrote:
From: "John W. Krahn" <[EMAIL PROTECTED]>
You could use a regular expression to do that.
my $input = get_input_from_user();
$input =~ /\A(?:[[:alpha:]]([[:alnum:]]{9})[[:alpha:]]|(\d[[:alnum:]]{7}\d))\z/
and my $username = $+;
[snip]
[snip]
I`m attempting to use the regexp that you provided in my own little login script...I cant seem to get it to work.
Im not calling or invoking anything in my script...trying to keep everything local for now.
I have attached my login checking example file...take a look and let me now if Im totally wrong in the way Im trying to use your regexp.
use strict; use CGI ":standard";
#stores the login name my$loginName = param("loginName");
#opens the file and puts the contents into an array open (DAT, "id.txt") or die("Could not open file!"); [EMAIL PROTECTED] = <DAT>; close (DAT);
#checks the value entered by the user against the values in the array foreach my$login (@loginData) { #ensures that the usernames are seperated in the txt file #carriage return is the delimeter chop($login);
if ($login eq ($loginName =~ /\A(?:[[:alpha:]]([[:alnum:]]{9})[[:alpha:]]|(\d[[:alnum:]]{7}\d))\z/))
{
print redirect("loginok.html")
}
That should be:
chomp $login;
if ( $loginName =~ /\A(?:[[:alpha:]]([[:alnum:]]{9})[[:alpha:]]|(\d[[:alnum:]]{7}\d))\z/ and $login eq $+ }
{
print redirect("loginok.html")
}
}
print redirect("loginng.html");
John -- use Perl; program fulfillment
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>