Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Reading concurrently two files with different number of lines

by topher (Scribe)
on Apr 11, 2013 at 15:35 UTC ( #1028184=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Reading concurrently two files with different number of lines
in thread Reading concurrently two files with different number of lines

diff would not understand the continuation lines, but it doesn't necessarily have to. You can break your problem into two parts, and attack them individually:

  1. Normalize your inputs
  2. Compare your inputs

The first you would do with Perl. Write a script that just handles the line continuations and normalizes your input into a "clean" format.

You could then use diff to do the actual comparison between the two files. If diff doesn't meet your requirements for some reason, your comparison code would still be cleaner and simpler for not having to deal with the line continuations.

Christopher Cashell


Comment on Re^3: Reading concurrently two files with different number of lines
Select or Download Code
Re^4: Reading concurrently two files with different number of lines
by frogsausage (Sexton) on Apr 11, 2013 at 15:50 UTC
    Thanks for the details. In the end, I already had my line to be compared in an array, so I just ended up using string comparison.

    I gave my "solution" below following my code working great here :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-07-31 02:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (244 votes), past polls