----- Original Message -----
From: "maureen" <[EMAIL PROTECTED]>
To: "Tanton Gibbs" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, January 23, 2002 5:04 PM
Subject: Re: Text file separators


> Thanks for your suggestion.  I tried this:
>
>  if( $username eq $in{username} &&
> >     $password ne $in{password} ) {
> >   # issue error here
> > }
> The test for username and password is now positive, every time text is
> entered into the username and password fields, even when text entered
> does not match any of the usernames or passwords in the file pwdata.txt.

Looking at your script below, the above test will always return true because
your $password will never be equal to $in{password}as it shall have an end
of line at $password, this is because you have put the chomp function at the
wrong place.

There are 2 places which you could put your chomp function :-

1) chomp (@indata = <FILE>); # or

2) foreach $i (@indata) {
                 chomp $i;
                 ...........
    };

---- end of my msg -----

> I'd appreciate any suggestions. Thanks again for your help, Maureen
>
> open(FILE,"pwdata.txt") || die "Can't find database\n";
> #store database contents in an array and close file
> @indata = <FILE>;
> close(FILE);
> #remove hard return character from each record
> chomp($i);
> foreach $i (@indata)
> {
> #split fields on pipe character
> #assign a variable name to each of the fields
> ($username, $password) = split(/\ | /,$i);
> if( $username eq $in{username} &&
>     $password ne $in{password} )



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to