What you are describing now looks like something fairly different from what you seemed to be describing before. I'm not even sure if this can be answered without resorting to crystal balls... I'll assume that you want to check if two values you enter in a form appear as two of the fields on the same line of your data file (name and password).
To do this, process the lines one by one, checking the two fields against the values that were entered. If they match, set a flag and break out of the loop. After the loop, check the flag to see if the input was "correct":
my $found = 0;
for (@lines) {
my (undef, undef, $theName, $thePass) = split;
if ($theName eq $name && $thePass eq $pass) {
$found++ and last;
}
}
# check for value of $found, etc, etc
— Arien