Sometimes you need to create a large tree of subdirectories. But why? Two
examples that I think of are structured directories for weblogs, e.g.
/[year]/[month]/[day]/, or the automatic backing up of files e.g.
Before you begin, you know that using a
chdir, or some other combination of
built-ins, will just make big mess. A call to
mkdir -p could also work,
but let’s use the available modules this time.
use File::Path 'make_path'; make_path('posts/2011/04/04');
This will create this structure below the current directory. Simple. There are many of these modules hidden (or less hidden) in the CPAN. THey like the light.