in reply to How do I create subfolders?
The mkdir function creates directories (which I assume are what you mean by "subfolders"). The open function can open files even if you prepend a path to them. If you want to create multiple directories in one go, have a look at File::Path.
use strict; use warnings; my $outdir = "output"; if (! -d $outdir) { warn "Creating '$outdir'"; mkdir $outdir or die "Couldn't create '$outdir': $!"; }; my $outname = "$outdir/test.txt"; open my $outfile, ">", $outname or die "Couldn't create '$outname' : $!"; print $outfile, "Hello World\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How do I create subfolders?
by bart (Canon) on Apr 02, 2006 at 10:47 UTC |