in reply to make_path for creating directory tree

It sounds like your question is about program logic, not about creating folders or using make_path. Sorry if I am mistaken.

It sounds like you need nested looping to do what you want. Also read up on range operators.

# hash defining your folder patterns my %patterns = ( AB => 30, BC => 50, CD => 42, ); foreach my $pattern ( keys %patterns ) { foreach my $folder ( 1 .. $patterns{ $pattern } ) { # construct the folder name using the value of # $pattern, the value of $folder_name, and sprintf() # use make_path() or whatever to create the folder foreach my $subfolder ( 1 .. 100 ) { # construct the subfolder name # create the subfolder } } }

Hope this helps!

The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: make_path for creating directory tree
by fasoli (Beadle) on Dec 23, 2015 at 17:18 UTC

    Yes exactly, I'm trying to figure out how to write this script, my biggest problem isn't make_path itself. I am not a programmer and I have to start every bit of programming I do by first sketching what I need to get in the end, in this case a directory tree - easy to draw, then I write in pen and paper how I think the code could look like, with one million mistakes of course, and then I try to write it. But I still lack the understanding of programming logic, you're right about that. Thanks for your answer and example, it's what I'm trying now.