The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


File::Cmp - compare files


  use File::Cmp;

  $status = cmp_file "filename1", "filename2";


cmp_file() compares the contents of two files. If they are identical cmp_file() return a value of 0. Otherwise it returns a positive nonzero value.

If one of the two files cannot be opened, cmp_file() returns -1.


cmp_file() checks to see if files have identical filenames, but maybe it should also check inode numbers?

It might be nice to have a version that would return the location of the first difference found.


Joseph N. Hall,