my $full_filename = $write_dir.'/'.$filename; open my $fh_out, '>', $full_filename or die "failed to open $full_filename for write $!";