Stuart Clemons wrote:
>
> This newbie would like to compare two files, let's say File1 and File2.   I
> want to put the difference from File2 only,  into a new file, File3.
>
> For example:
>
> File1.txt
> oranges
> apples
> bananas
>
> File2.txt
> apples
> kiwi
> bananas
>
> The result I want for File3 is the new entry in File2, which is kiwi.  (I
> don't care that oranges was in File1 and not File2.)
>
> Can the Text:Diff module (or some other means) do this ?  (I looked at the
> Text::Diff doc and it wasn't obvious to me.  I hope to play with this later
> this evening or tomorrow.)

Hi Stuart.

Yes, Text::Diff will do that for you, but you will have to write your own
formatting class to generate it as it's not one of the standard output
formats.

You have to be clear that this is the correct solution for you though, as
Text::Diff insists that the entirety of the two files to be compared are
first read into arrays. It may be just as simple to do that anyway and
write something yourself to compare the two, especially if the ordering of
the records and multiple identical records aren't signnificant.

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to