Search notes:

Perl function: mkdir

Perl's mdkir won't create nested (sub-)directories (as a shell's mkdir without the -p option).
To create nested subdirectories, use the Perl module File::Path (function make_path):
#
#   mkdir FILENAME, MASK
#   mkdir FILENAME
#   mkdir
#
use warnings;
use strict;

use File::Path qw(rmtree make_path);


rmtree     'new-directory' if -d 'new-directory';
mkdir      'new-directory' or die "could not create new-directory";

mkdir      'another-directory/sub-directory' or print "mkdir cannot recursively create directories, use File::Path->make_path instead\n";
make_path  'another-directory/sub-directory' or die;
Github repository about-perl, path: /functions/mkdir.pl

See also

Perl functions

Index