File::Find uses global variables (like $File::Find::name), so with these, you might encounter problems when starting two recursive instances of File::Find. It also changes the current directory of your process, which is another global state, but it restores the directory upon completion of the recursive descent. Other than that, I don't see any caveats. What happened when you tried it in your code (that you keep jealously hidden from our prying eyes)?
You likely won't find much of a speedup over your opendir, readdir and closedir solution, as File::Find uses the same functions. IO always is slow.
If you just want exactly all directories two levels down, have a look at glob:
my @directories_two_levels_down = grep { -d } glob './*/*';
Also, Yes, even you can use CPAN
In reply to Re: using File::Find within File::Find
by Corion
in thread using File::Find within File::Find
by pauloke
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |