in reply to how to create folders

Thank you all for your suggestions. This is the code I ended up using, and it works great:
opendir DIR, "." or die $!; my @dirs = grep { /object...000/ && -d "$_" } readdir(DIR); closedir DIR; @dirs = sort @dirs; my $highest = $dirs[-1]; print "highest: $highest\n"; $highest =~ s/object//g; $highest += 1000; my $limit = $highest + 10000; ($login,$pass,$uid,$gid) = getpwnam('apache') or die "apache not in passwd file"; while ($highest < $limit) { print "object$highest\n"; mkdir "object$highest"; chown $uid, $gid, "object$highest"; chmod 0777, "object$highest"; $highest += 1000; }
Thanks again.

Replies are listed 'Best First'.
Re^2: how to create folders
by GrandFather (Saint) on Mar 28, 2007 at 09:19 UTC

    Consider:

    print join ", ", sort 1 .. 10;

    Prints:

    1, 10, 2, 3, 4, 5, 6, 7, 8, 9

    DWIM is Perl's answer to Gödel