use strict; use warnings; use Digest::SHA; open my $in_1, '/tmp/f1.txt'; open my $in_2, '/tmp/f2.txt'; my $hash1 = Digest::SHA::sha1_hex( do { local $/; <$in_1> } ); my $hash2 = Digest::SHA::sha1_hex( do { local $/; <$in_2> } ); die "The files are NOT the same\n" unless $hash1 eq $hash2; print "The file contents are identical\n"; #### md5sum file1 file2 file3 etc