This is a reimplementation of the unix diff program. You name two files on the command line, and diff tells you where the files differ, in a format similar to the output of the standard diff -u. For example, if the two files contain lines as follows:
File 1 File 2 ------ ------ a c b d d e h f j h k i j
Then the output of diff will look like this:
1- a 2- b 1+ c -------- 3+ e 4+ f -------- 6+ i -------- 6- k --------
What does this mean? It is a set of instructions for turning file 1 into file 2. The instructions come in four chunks, separated by --------. The first chunk says that in file 2, the `a' and `b' have been removed and replaced with `c'. The second chunk says that file 2 has `e' and `f' that are not present in file 1. The third chunk says that file 2 has `i' that is not present in file 1. The last chunk says that the `k' is missing from file 2.
If you don't like this output format, it shouldn't be very hard to change. See the documentation for LCS.pm for more details; that's where most of the work is done.This was the initial release.
Return to: Universe of Discourse main page | What's new page | Perl Paraphernalia