http://www.perlmonks.org?node_id=20522

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: (files)

Originally posted as a Categorized Question.

  • Comment on How can I compare (the content of) two files?

Replies are listed 'Best First'.
Re: How can I compare (the content of) two files?
by devslashneil (Friar) on Jun 18, 2003 at 03:00 UTC
    Another way would be to use File::Compare
    eg.
    use File::Compare; if (compare("file1","file2") == 0) { print "They are the same\n"; }
Re: How can I compare(the content) two files?
by Anonymous Monk on Jun 30, 2000 at 05:21 UTC
    Well, you can use diff, if you're in Unix (or Windows? I don't know):
    % diff file1 file2
    If you're looking to do it in Perl, check out Algorithm::Diff.
      #If you just want to know if the files are equal, you could use File::Compare;
Re: How can I compare(the content) two files?
by Anonymous Monk on Jun 30, 2000 at 18:50 UTC
    On windows, it's fc.exe. For example,
    c:\> fc file1 file2