Did you notice the error message? It was coming from this line:
open(THISFILE,'< $file') or warn "ERROR: Can't open $outfile!\n";
which means the input file is not being opened so you aren't
MD5ing (nice verb) what you think you are. The single quotes
stop the variable interpolation, try this:
open(THISFILE,'<'.$file) or warn "ERROR: Can't open $file: $!\n";
Note also that the warn should mention the correct file, not your
output file. Even better, include $! to get more post-mortem info.