http://www.perlmonks.org?node_id=1186610


in reply to Directory Structure.

Use File::Path, a core module, which provides make_path. Also, map comes in handy here -- make_path can create several directories at once, so you can save the foreach:

use File::Path qw/make_path/; # ... make_path map { "$dir/$_" } @files;