# join files in whatever way you feel like if (not eof(F1)) { print ; } elsif (not eof(F2)) { print ; }