First, you should always check to make sure the open worked:

open(FILE, $query->param('name')) or die "Can't open file";
Actually, I would not open any file directly from user input. Others may disagree in this case, but I would validate that param('name') is something you expect, likely /^\w+$/, or something similar.
If you had warnings turned on (which you should, -w) you would see that @file[1] is better written as $file[1]. You may want to consider putting all the HTML you are printing in a here doc, what you have is pretty hard on the eyes. As for why they do not match, you may want to chomp() the line you get from the file. If the file only contains one line, you should use this:

open(FILE, $name) or die "Can't open $name"; $pass = <FILE>; close FILE; chomp $pass; if ($query->param('pass') eq $pass) { ...etc...

Cheers,
KM


In reply to RE: Re: If by KM
in thread If doesn't work by MAS4891

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.