perl -MDigest::SHA=sha256_hex -le "print sha256_hex <>" <path to filename> returns the same SHA 256 value as the UNIX command shasum -a 256 <path to filename>.
However, when the Digest::SHA module is called from within a perl script the output value is different
$file = /path to filename;
print sha256_hex("$file");
The print command should return the same value but I cannot work out a method to do this.