in reply to Re^2: How can one create a text file in the subfolder of a folder?
in thread How can one create a text file in the subfolder of a folder?

Or:

map {mkdir $_; chdir $_;} @folders; my $output="z.txt"; open (my $fh,">",$output) or die "Cannot open file '$dirname/$output'. +\n";

That, of course, assumes your code doesn't have other assumptions about the current folder.

Much better to use File::Path, Path::Tiny or similar module.

  • Comment on Re^3: How can one create a text file in the subfolder of a folder?
  • Download Code