Another article for your viewing pleasure. This
article
describes how to use Perl’s IO based IO::Handle IO system and a
couple of modules that allow you do to some interesting things like seamlessly
handle compressed files and calculate MD5 sums as you read a file in.

use IO::Digest;

my $fh = new IO::file($filename, "r");
my $iod = new IO::Digest($fh, ’MD5’);

read_and_parse($fh);

print $iod->hexdigest