Re: IF statments -- ORs short circuit too

2002-12-24 Thread Rob Richardson
--- Michael Kelly <[EMAIL PROTECTED]> wrote: > Only and's short-circuit. Or's test every argument by necessity. Mike, In just about every Perl script that has to read from or write to a file, you will see a line similar to the following: open (MYFILE, "myfile.txt") or die "Can't open myfile.tx

Re: IF statments

2002-12-24 Thread Todd Wade
"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 >

Re: IF statments -- short circuit

2002-12-24 Thread Michael Kelly
On Mon, Dec 23, 2002 at 10:35:59AM -0600, David Gilden wrote: > 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 $

IF statments -- short circuit

2002-12-23 Thread David Gilden
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 happ

Re: IF statments -- part 2

2002-12-23 Thread zentara
On Mon, 23 Dec 2002 02:10:17 -0600, [EMAIL PROTECTED] (David Gilden) wrote: >This is not working either > ># Goal, to check against two different passwords. > >#!/usr/bin/perl >my $qs = 'c'; >my $secret_word = 'a'; >my $secret_word_guest = 'b'; > >if ($qs !~ /$secret_word_guest|$secret_word

Re: IF statments

2002-12-23 Thread zentara
On Mon, 23 Dec 2002 01:33:58 -0600, [EMAIL PROTECTED] (David Gilden) wrote: >I would like to be able to test for either of the two secret words >but it seems to fail, what am I missing? >#!/usr/bin/perl >use CGI qw/:standard/; >use CGI::Carp qw(fatalsToBrowser); >use strict; > >my $qs = $ENV{'Q

IF statments -- part 2

2002-12-23 Thread David Gilden
This is not working either # Goal, to check against two different passwords. #!/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... What should happe

IF statments

2002-12-22 Thread David Gilden
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