Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Find changes or differences in 2 text files

0 views
Skip to first unread message

Bill H

unread,
Sep 3, 2008, 2:09:42 PM9/3/08
to
Is there a simple perlish way (or module) of comparing 2 text files
(or 2 strings containing their contents) and determining what is
different between the two? These text files are straight text, not
data of any type. Something along the lines of Diff without having to
shell out to it (unless Difff is faster).

Bill H

Leon Timmermans

unread,
Sep 3, 2008, 2:20:28 PM9/3/08
to

Please try CPAN before asking these kinds of questions. If you did, you
would have found Text::Diff, which does exactly what you are asking for.

Regards,

Leon Timmermans

Bill H

unread,
Sep 3, 2008, 2:57:33 PM9/3/08
to

Leon

Thanks for the tip - FYI searching for any variation of:

Find changes or differences in 2 text files

Finds nothing on Cpan. The search engine on there is very limited. I
would need to know what I am looking for to find what I am looking
for. And if I search for Diff, I get 124 different modules to dig
through.

Bill H

Tad J McClellan

unread,
Sep 3, 2008, 8:30:26 PM9/3/08
to
Bill H <bi...@ts1000.us> wrote:
> On Sep 3, 2:20 pm, Leon Timmermans <faw...@gmail.com> wrote:
>> On Wed, 03 Sep 2008 11:09:42 -0700, Bill H wrote:

>> > Something along the lines of Diff without having to shell out to
>> > it (unless Difff is faster).

^^^^^^^^^
^^^^^^^^^

Are you coding a high-performance application or expect hundred-Mb
strings to compare or something?

"Premature optimization is the root of all evil". (Google it)

First you want an approach that does what you want it to do.

Only if the 1st approach proves to be too slow should you
concern yourself with execution speed.


>> Please try CPAN before asking these kinds of questions.


This is some very sage advice. Please don't dismiss it...


> Thanks for the tip - FYI searching for any variation of:
>
> Find changes or differences in 2 text files
>
> Finds nothing on Cpan. The search engine on there is very limited.


It is a keyword search, not a natural language processing search.

You need to give it a keyword.

Like "Diff", which you already knew was a relevant keyword.


> I
> would need to know what I am looking for to find what I am looking
> for.


You did know what you were looking for, you were looking for
something along the lines of "Diff", so I fail to see the
relevance of the quote snippet above.


> And if I search for Diff, I get 124 different modules to dig
> through.


FYI, posting here rather than first taking the 5 minutes necessary
to dig through CPAN results can severely damage your ability to get
help with future Perl questions.


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"

0 new messages