use File::Path; foreach my $n ( 0 .. 12 ) { mkpath("/blah/$n", 1, 0755) or die "$n: $!"; }