PERL 5.6
OSX, Jaguar
Goal, to check against two different passwords.
I think my problem is the "or" is short 'circuited'
is there a way for an IF statement to test for both
values, so that either $secret_word or $secret_word_guest
will be tested, (I am not looking for AND)
What should happen is that if $secret_word OR $secret_word_guest does not Match $qs
Then it should print 'Fail'. It needs to check both!
I have tried this, and still does not do what I want, and I can
understand why.
Thanks.
Dave
PS: someone kill the spanish auto-responder
#!/usr/bin/perl
my $qs = 'c';
my $secret_word = 'a';
my $secret_word_guest = 'b';
if ($qs !~ /$secret_word_guest|$secret_word/) {
print "fail\n";
} else { print "go, ok\n";}
.... more code...
# OR #
#!/usr/bin/perl
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
use strict;
my $qs = $ENV{'QUERY_STRING'};
my $secret_word = 'one';
my $secret_word_guest = 'two';
if (($qs ne $secret_word_guest) or ($qs ne $secret_word)) {
print "Bad password";
exit;
}
-----------------
# I also tried
if ($qs ne $secret_word_guest or $secret_word)) {
print "Bad password";
exit;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]