The OP can also use File::Find to recurse through sub directories.
#! /usr/bin/perl -w
use strict;
use warnings;
use File::Find;
my @directories = @ARGV ? @ARGV : ('.');
find(\&wanted, @directories);
sub wanted
{
return unless /\.dll$/i;
# Do something with $File::Find::name
}
| [reply] [d/l] |
Personally, I'd never use File::Find where glob does the job. The need for the sophistication and overhead of F::F is less on win32 where you don't have links and most other forms of pseudofiles to deal with.
I like the fact that glob does a large amount of the work of pre-filtering of names before it gives me anything.
I also infinitely prefer it's iterator form over any callback style function.
And finally, I like that I can give it either a relative or absolute path plus wildcard and it will give me back the same type of paths, which most times is exactly what I want. Even when traversing subdirectory trees, I prefer to decide which directories to decend into, and in which order, at the point of use rather than stacking up large arrays. It uses less memory, and means I can abort or restart a search part way through if needed--something that is near impossible with the callback style of interface.
In fact, I can honestly say that I have no code, beyond my initial, aborted experiments, that uses File::Find, or any of the other callbacks+globals, style of doing things. YMMV :)
Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
| [reply] |