use File::Compare; if (compare("file1","file2") == 0) { print "They are the same\n"; }