develooper Front page | perl.beginners | Postings from December 2002

RE: check against two different passwords.

Thread Previous | Thread Next
From:
Timothy Johnson
Date:
December 23, 2002 09:33
Subject:
RE: check against two different passwords.
Message ID:
C0FD5BECE2F0C84EAA97D7300A500D50046DD33A@SMILEY

How about this:

if ($qs !~ /($secret_word_guest|$secret_word)/) {

or 

if ($qs ne $secret_word_guest && $qs ne $secret_word_guest) {

-----Original Message-----
From: David Gilden [mailto:dowda@coraconnection.com]
Sent: Monday, December 23, 2002 9:15 AM
To: beginners@perl.org
Subject: check against two different passwords.


Hello,

in the following 

# Goal:  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";
        }



another version:

#!/usr/bin/perl 

my $qs = "a";
my $secret_word  = 'a';
my $secret_word_guest  = 'b';

if ($qs ne ($secret_word_guest || $secret_word)) {
print "fail\n"; 
} else { print "go, ok\n";}

--------
the original works fine! 
if ($qs ne  $secret_word) {
print "fail\n"; 
exit;
} 


What should happen is that if $secret_word OR $secret_word_guest does not
Match $qs 
Then it should print 'Fail'.

The above behaves correctly, but when I try to bring a second test,
it fails....

I can not seem to get this to do what i want!
Can any one show me by example what is wrong.

Dave
---------
OSX, Jaguar PERL 5.6
====================================================
Cora Connection: Your West African Music Source
Resources, Recordings, Instruments & More!
<http://www.coraconnection.com/> 
====================================================

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About