Your problem here is not due to CGI.pm. while does not set $_. Plus I think you're forgetting to get rid of the newline. Try this instead:
while (chomp($_ = <FILE>)) { do stuff; }
Update - I'm crazy. while does set $_, but I customarily chomp in the fashion above and I guess I forgot why. :-(
if ($user eq $q->param('ueq &encrypt_pass) {

The above code shouldn't compile. The foreach after it is also completely unnecessary (no sense looping over 1 value). Maybe it ought to look something like:

my $user = $q->param('username'); my $pass = $q->param('password'); verify($user, $pass) or die "No user or password incorrect"; sub verify { my ($ck_user, $ck_pass) = @_; open FH, $user_file" or die "Can't open file, $!"; while (chomp($_=<FH>)) { my ($user, $pass) = split '\|'; if ($user eq $ck_user) { if ($pass ne crypt(ck_pass)) { return 0; } else { return 1; } } } return 0; }
Adjust the return values to suit the logic of your program. I assume that at a minimum you might like to know if the user exists in the user list and whether or not their password is correct.

In reply to Re: Reading from multi line file -> CGI.pm by virtualsue
in thread Reading from multi line file -> CGI.pm by FireBird34

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.