in reply to Recursion not working

I think you want to be constructing a new Digest::MD5 object for each file, not reusing the same one. Otherwise you'll get a cumulative digest.

I strongly suggest looking at Path::Class which makes working with files and directories a lot easier, reducing a lot of "boilerplate" code.

use Digest::MD5 (); use Path::Class (); sub ScanDir { Path::Class::Dir::->new(shift)->recurse(callback => sub { my $file = shift; return if $file->is_dir; my $stat = $file->stat; printf( "%s, %s, %s, %s, %s\n", $file->absolute, $stat->size, $stat->atime, $stat->mtime, Digest::MD5::->new->addfile($file->openr)->hexdigest, ); }) } ScanDir("/tmp");

Path::Class::Rule is also good fun, though not especially useful for this particular task.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'