my $path = File::Spec->catfile($dir, $file); open(OUT, '>', $path) or die;