You should have a
<FILE> in the while() loop. The
<FILE> tells perl to loop through your file one line at a time. You can also read the whole file into memory by doing
@lines = <FILE> but it's up to you if you want to use that memory.
if($pword==$cpword){
open (FILE, "memberlist.txt");
while(<FILE>){
push @lines,$_;
close FILE;
}
}
UPDATE: You might also want to try checking your open statement to make sure it worked.
open (FILE, "memberlist.txt") || die "Cannot open: $!";
The $! gives you the error message from the open command if it failed.