Hi,
This question is slightly different to the topic above but I noticed that the code being used above is similar to above.
I'm trying to compare 2 text files and find out whether they contain the same data.
Here's my code:
-
use File::Compare;
-
-
if (compare("C:\files\a.txt","C:\files\b.txt") == 0) {
-
print "They're equal\n";
-
} else {
-
print "They are not equal";
-
}
-
The odd thing is, is that it always said the files are not equal. Even if I try and compare the same file it says they are not equal.
Can anyone shed some light on this?
Thanks
Nush
I am not really sure about the module you are using as I haven't looked at it before. But, in the mean time, the issue you are having is actually more different than you think from the rest of the thread. The other person is taking multiple files and combining them into one file, minus any duplicate lines from the files that may exist.
You, on the other hand, just want to compare two files to see if they are the same.
It is a bad idea to piggy back your question onto someone elses thread as you may find it will possibly be missed. It is always best to start a new thread.
Regards,
Jeff