Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by supriyoch_2008 (Monk)
on Apr 22, 2017 at 13:23 UTC ( [id://1188618]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1188618]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-20 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found