in reply to Re: Recursion and Such
in thread Recursion and Such

I thought about using the mkdir() from perl, but my problem is that if a nested directory structure doesn't exist

i.e. /foo/bar/foobar/

then the code

mkdir("/foo/bar/foobar/");

is going to fail. Therefore I used a system call with the -p option so that any depth of directory will be created without failures.
As for the recursion bottoming out, just run the code. If it runs inifinitely then it doesn't bottom out. If it exits out, then it has a base case.

Thanks for the pointers.

Replies are listed 'Best First'.
Re^3: Recursion and Such
by Tanktalus (Canon) on Jan 31, 2005 at 20:32 UTC

    Check out File::Path - it has a function mkpath which solves that problem for you. Anything to avoid an unnecessary system call ;-) (Also note that this is part of the standard perl distribution so you can just use it anywhere without having to require extra modules.)

      Wow, that is a great suggestion. Thanks for the tip, I definitely prefer not to make direct calls to the system.