Hmm... in that case, it looks about right. But a few things spring to mind:
You don't remove the trailing line-end from $output. You should do something like:
while ($output = <LIST>) { chomp $output; $file = 'test.pat'; $file2 = $output; $file3 = "$output.res"; ...
You haven't shown the code that creates the COMPARE file. Is it possible that it fails after the first run, so you always pick up the same COMPARE file? Maybe it fails if COMPARE already exists?
When you open the COMPARE file, you should check whether the open() is actually successful, too:
open (COUNT, "<COMPARE") or die "Can't open COMPARE: $!";
There are other things you could do which might help you find the problem, such as use strict; use warnings;
I hope this helps a little. Let us know how you get on.
In reply to Re^3: while loop returns same values
by muntfish
in thread while loop returns same values
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |