Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: reading two files in parallel

by sundialsvc4 (Abbot)
on May 02, 2013 at 12:36 UTC ( #1031748=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: reading two files in parallel
Re^2: reading two files in parallel
by karlgoethebier (Curate) on May 02, 2013 at 17:48 UTC
    «As a slight note, Moritz’s solution as-written does not seem to consider what to do with the leftover records...»

    May be this is true. But what is your solution?

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Re^2: reading two files in parallel
by Laurent_R (Parson) on May 02, 2013 at 18:55 UTC

    This thing is easy if you know that each file will have an exact match of records. Much less easy if you can have missing lines in one of the files or the other.

    I wrote a program doing comparison between to very large files, handling all the cases of records existing in one file and not in the other with all the special cases (file A finished before B, or the other way) is not really trivial.

    I am working on transforming this program into a module as generic as possible, but, unfortunately, it is not ready to be used.

Re^2: reading two files in parallel
by moritz (Cardinal) on May 02, 2013 at 19:12 UTC
    The necessary additions, to be placed after what is shown, are trivial

    No. The trivial additions are most certainly wrong.

    If F2 is exhausted first, the last line read from F1 inside the loop is lost, because $a is scoped to the block, and last leaves that block.

Re^2: reading two files in parallel
by Anonymous Monk on May 02, 2013 at 23:45 UTC
    Seem like this should have been a reply to moritz's post

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031748]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2014-09-30 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (384 votes), past polls