http://www.perlmonks.org?node_id=1031748


in reply to reading two files in parallel

As a slight note, Moritz’s solution as-written does not seem to consider what to do with the leftover records in the longer of the two files.   The necessary additions, to be placed after what is shown, are trivial ... the only trick being to ensure that the first leftover record is processed.