in reply to How can one create a text file in the subfolder of a folder?

Here is a way to do it with Path::Tiny.
#!/usr/bin/env perl use strict; use warnings; use Path::Tiny; my $x='x'; my $y='y'; my $dirpath = path($x, $y); $dirpath->mkpath; my $outpath = path( $dirpath, 'z.txt' ); my $fh = $outpath->openw_utf8; print $fh "\n It's ok.\n"; $fh->close; print "\n Program is over.\n"; exit;