[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] CGI line reader



At 10.21 11/7/97, Richard Duff wrote:
>I am trying to create a CGI using MacPerl that prompts someone for their
>password and then verifies it.  The archive will contain a list of
>passwords in the following format:
>
>PASS1
>PASS2
>PASS3
>PASS4
>
>I already have the open(CHECK, '<passwords.txt') or die "Can't
>Verify!!!\n"; command, but I am a little lost after that.  Shoud I use
>$Line = <INPUT> or $Line = $_ or something else?  Can someone help?

Well, this is not a MacPerl-specific question.  Please, in the future, reserve these questions for general Perl resources, like comp.lang.perl.misc on usenet.

Anyway, I would likely do something like the following:

open(CHECK, 'file') || die $!;
while (defined($line = <CHECK>)) {
  chomp($line);
  $match = 1 if ($line eq $mypass);
}
close(CHECK);

--
Chris Nandor               pudge@pobox.com           http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==                    MacPerl: Power and Ease                     ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch