in reply to Re: nested loops to compare 2 files is only looping a limited number of times.
in thread nested loops to compare 2 files is only looping a limited number of times.

yes, the loops do break on the first failed match of file 1 against file 2.

I can see that that is what is breaking it now that you've pointed it out but I was under the impression that when the inner loop had gone to the end of it's file it would break to the next iteration of the outer loop.

do I need to label the out loop (e.g. LABEL:) and then do something like  if (/EOF/) { next LABEL;} then?

  • Comment on Re^2: nested loops to compare 2 files is only looping a limited number of times.
  • Download Code

Replies are listed 'Best First'.
Re^3: nested loops to compare 2 files is only looping a limited number of times.
by Transient (Hermit) on Jun 23, 2009 at 13:33 UTC
    When the inner loop goes to the end of it's file, it stays there. It doesn't reset the file pointer every time you enter that while loop.

    adding a seek BS, 0, 0 before your inner while loops should get your on the right track.