in reply to Re^2: comparing any two text files and writing the difference to a third file
in thread comparing any two text files and writing the difference to a third file
But currently I am learning perl, a total beginner. I did my basic lessons and was trying to give myself a challenge with this program.I think you've picked a rather challenging problem to solve in the general sense. This is the sort of thing that sounds easy when viewed from 30,000 feet, but from 50 feet, a lot of details emerge. Hey, those things that looked like ants are really people...etc...
I briefly perused the code presented by Hippo at Re: comparing any two text files and writing the difference to a third file. It appears to be well structured and well commented. A lot could be learned by intense study and experimentation with this code. I would add print statements to try to understand what each part is doing. There are some constructs that I would not expect a beginner to come up with, but study of this code would be instructive.
When faced with a complex problem, one idea is to simplify and solve a related, but less complex problem. One of the issues with file level diff is re-synchronization after a different block of lines is detected. How about just working with pairs of lines (and words within those lines) to start with?
What about a "substitution"?.
This might have to be represented as a deletion and an addition?
|
|---|