in reply to skip newline charater when reading

while ($line1 =<F1> || $line2= <F2>){ foo($line1,$line2); }
That's not going to do what you want. It reads from F1; if successful, it assigns that to $line2 and leaves $line2 and F2 as is. If reading from F1 fails (for instance, at the eof), it reads from F2, assigns that to both $line2 and $line1.

It may be that you want:

while (defined ($line1 = <F1>) and defined ($line2 = <F2>)) { ... }