my $ctx = Digest::MD5->new; for my $file (glob "dir/*") { open my $fh, '<', $file or next; $ctx->addfile($fh); }