First of all, marto is right that you don't need to call an external command for this, there is mkdir, and also make_path from the core module File::Path (Update: which can do the equivalent of mkdir -p). For proper handling of filenames, see the core module File::Spec, or, with a nicer interface, Path::Class from CPAN.
use File::Spec::Functions qw/catdir/; use File::Path qw/make_path/; make_path(catdir('folderA','folderB','folderC')); # Update 2: OR: use Path::Class qw/dir/; dir('folderA','folderB','folderC')->mkpath;
Only for the sake of completeness: I wrote about different ways to call external commmands (safely) at length here.
In reply to Re: pass a variable or string to shell command from perl script (updated)
by haukex
in thread pass a variable or string to shell command from perl script
by thadc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |