in reply to Re: 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?

Hi Shmem,

Thank you for your suggestion.

With kind regards,

supriyoch_2008

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

Replies are listed 'Best First'.
Re^3: How can one create a text file in the subfolder of a folder?
by shmem (Chancellor) on Apr 22, 2017 at 14:47 UTC
    Thank you for your suggestion.

    You're welcome. But what I wrote wasn't a suggestion - it was telling you where the problem is.
    But since you thank me for a suggestion, here is one:

    use Cwd; my $cwd = getcwd(); ... map {mkdir $_; chdir $_;} @folders; chdir $cwd;
    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
Re^3: How can one create a text file in the subfolder of a folder?
by RonW (Parson) on Apr 26, 2017 at 22:07 UTC

    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.