in reply to using File::Find within File::Find
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: using File::Find within File::Find
by pauloke (Initiate) on Dec 12, 2008 at 11:00 UTC | |
by Corion (Patriarch) on Dec 12, 2008 at 11:02 UTC | |
by pauloke (Initiate) on Dec 12, 2008 at 12:02 UTC |