This is what's happening: You're getting to this while statement, and $line gets the first line from the file. You're finding that the first line of the file doesn't match $checkthree, so the else is executed, the line is printed, and the while is exited. To fix this, try some like the following.while (my $line =<FILE>) { my ($one,$two,$three,$four,$five) = split "\t",$line; if ($three eq $checkthree) { print "<p>With matching parameters I should be able to see this + </p>"; last; } else { print "<p>If I put the else statement in it ignores the fact t +hat the parameters match - and comes here! (But I don't know why).</ +p>"; last; } }
my $matched; while (my $line = <FILE>) { my ($one,$two,$three,$four,$five) = split "\t",$line; if ($three eq $checkthree) { print "<p>With matching parameters I should be able to see thi +s </p>"; $matched = 1; last; } } unless ($matched) { # this is like the else print "<p>If I put the else statement in it ignores the fact that +the parameters match - and comes here! (But I don't know why).</p>"; }
elusion : http://matt.diephouse.com
In reply to Re: data field extraction not as expected
by elusion
in thread data field extraction not as expected
by jonnyfolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |