in reply to Glob vs File::Util vs File::Find
I'd use File::Find. It's a core module, so it will always be anywhere you find Perl. It takes more code to write, but it's still not that bad:
sub find_text_files { my $dir = shift; my @text_files; my $tf_finder = sub { return if ! -f; return if ! /\.txt\z/; push @text_files, $File::Find::name; }; find( $tf_finder, $dir ); return @text_files; }
(Not tested.)
It would be a little easier using File::Find::Rule, but that's not core.
|
|---|