"David Gilden" <[EMAIL PROTECTED]> wrote in message news:r01050400-1023-E78ABED6164811D78F0D0003935B6868@[192.168.1.5]... > Holiday greetings, > > I would like to be able to test for either of the two secret words > but it seems to fail, what am I missing? > Thanks > Dave > > > #!/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; > } >
Logic is a cool science in itself. You want to 'and' your operands, not 'or'. 'or' only evaluates its second operand if its left one is false. lets say $qs eq 'one'. so your conditional would look like: if (('one' ne $secret_word_guest) or ($qs ne $secret_word)) { .... which makes the left operand true, so you get unwanted behavior. HTH, Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]