On 02-Nov-00 at 02:49:26 Larry Mintz wrote:
> It can't this stupid program to terminate properly.
> Here it is:
>
> It ask you for your name then your password. If it doesn't match it goes
> into a loop until it gets it right. The problem is when you enter the
> correct password for the correct name it goes into the loop endlessly. I
> can't figure out why. This problem arose when I created the init_words
> sub routine. before I used the array
>
Two things - first the code you sent had as the first line:
# /usr/bin/perl -w
and I guess this should have been:
#! /usr/bin/perl -w (note the second character - an exclamation)
Second point is that I would check the data file (wordlist) - run it through
'cat -vet' to see if there any odd characters - in particular spaces at the
end of the line. This will case a staright 'eq' test to fail. Typically when
reading from a file like this I perform a 'trim' on each line to remove
leading/trailing spaces - something like:
sub trim {
$_[0] =~ tr/ / /s;
$_[0] =~ s/^\s+//o;
$_[0] =~ s/\s+$//o;
return;
}
Other than that the program looks okay.
John.
------------------------------------------------------------------------
John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
E-mail: [EMAIL PROTECTED]
PGP key available from public key servers
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list