#!/usr/bin/perl -l #use strict; use warnings; use Digest::SHA1; my $fname = $ARGV[0]; my $sha1; open(IN, $fname) || die "can't open '$fname' for input: $!"; binmode IN; $sha1 = Digest::SHA1->new; $sha1->addfile(IN); print $sha1->hexdigest; open(IN, $fname) || die "can't open '$fname' for input: $!"; binmode IN; $sha1 = Digest::SHA1->new; $sha1->addfile(*IN); print $sha1->hexdigest; open(my $fhIN, $fname) || die "can't open '$fname' for input: $!"; binmode $fhIN; $sha1 = Digest::SHA1->new; $sha1->addfile($fhIN); print $sha1->hexdigest; system 'sha1sum', $fname; #### $ ./840698.pl foo e242ed3bffccdf271b7fbaf34ed72d089537b42f e242ed3bffccdf271b7fbaf34ed72d089537b42f e242ed3bffccdf271b7fbaf34ed72d089537b42f e242ed3bffccdf271b7fbaf34ed72d089537b42f foo