in reply to Reading concurrently two files with different number of lines

It might be simplest to loop while (!eof(A) or !eof(B)), and then read a line of each (if available) inside the loop body.

  • Comment on Re: Reading concurrently two files with different number of lines

Replies are listed 'Best First'.
Re^2: Reading concurrently two files with different number of lines
by frogsausage (Sexton) on Apr 10, 2013 at 15:55 UTC
    Thanks for the answer.

    After looking at the perldoc, eof(FH) is only returning if EOF is reached. In that case, it seems that using defined() will do as good as either $lineA or $lineB will be set to undef (and therefore be tested in the loop).

    Is that correct?