in reply to Is there a better way to get all the t/.t test files an array?
If you don't need a recursive search, davido's idea to use glob is preferable. If you do, however, File::Find is a fine solution. Your sub can be cleaned up a bit, though:
sub get_files { my $directory = shift; my @files; find(sub { return unless /\.t$/; my $n = $File::Find::name; $n =~ tr{\\}{/}; push @files, $n; }, $directory); return @files; }
|
|---|