Quickly looking at your code:
You use different variable names for something that I think is the same thing: my $OUTFILE_fname = $file.".html"; and result_dir/$OUTFILE_file_name
Maybe result_dir should be $result_dir?
I think you should:
use warnings
use strict