Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
November 30, 2008, 5:56 pm
rate this thread
The following code would give the following error, if the dir 'xy'
does not exist.
print() on closed filehandle OUT at ./open.pl line 7.
I'm wondering if there is a perl command that is smart enough to
create an directory automatically when it opens a file for write.
print OUT "Hello World\n";
Re: Is there a command to open a file as well as to create the directory if it is not exist?
I wouldn't want to use such a command, the chances of messing up the
file system are just too big.
Why not simply check if the directory exists (-d) and if it doesn't then
create it (after confirming, that you really, really meant to create a
If it's a tree then use File::Path to create the whole tree with one
- » FAQ 8.11 How do I decode encrypted password files?
- — Next thread in » PERL Discussions