From: Uri Guttman on
>>>>> "S" == Subhash <subhash12(a)gmail.com> writes:

S> Yes Uri, have explicitly imported cmp of File::Compare module.
S> ran diff under UNIX, it showed the difference in the last line only.
S> (ie) the blank line

but was it just a newline which chomp could handle or were there blanks
in it? diff won't show you that. you need to look carefully at that last
line to see what is in it. then write your trim to handle it.

uri

--
Uri Guttman ------ uri(a)stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
From: J�rgen Exner on
Subhash <subhash12(a)gmail.com> wrote:
>Im comparing two files. Newer file has blank-line introduced at the
>end. So the file difference is only a blank-line at the end.[...]
>which would chomp the lines and then compare the difference if any.
>But still there is difference.

This is a wild guess only but a blank line even after it is chomp()ed is
still something different than no line (empty string versus EOF or
undef).

Even more: if I were to implement this function then the first thing I
would check is the file size. If the file size is different -and your
second file must be larger by your own description- then don't even
bother comparing the content because the contents cannot possibly be the
same.

The easiest solution might be to append a blank line to the older file,
too, if necessary in a temporary copy, and then compare their contents.

jue