in reply to File comparison problem!

I notice that you call compare twice, if the first one doesn't register that they're equal. You should assign the result of the compare to a variable and test that.

When I compare a file to itself, I get the expected result of equality:

>perl -MFile::Compare -e "print compare('cookies.txt', 'cookies.txt')" 0
Is $filename possibly still open at the time you compare?

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re: Re: File comparison problem!
by Elijah (Hermit) on Dec 01, 2003 at 23:10 UTC
    Yeah when I compare a file to itself it returns the proper indication. But what I meant by comparing it to itself is that I make a temp file of the file itself along with any changes and then compare it to the file as it was when opened without any changes. Now if I open the file and then close it right away the 2 files should match exactly seeing how there were no changes made but they do not match.