Hi, I have just noticed your post and would like to propose an alternative approach. It uses the File::Find::Rule package and simplify things (in my view).
This is running on perl 5.16.0
use strict;
use warnings;
use autodie;
use File::Find::Rule;
my @f_files = File::Find::Rule
->file
->name(qr/^f.*$/)
->in(qw(/dir1 /dir2 /dir3 ));
foreach (@f_files) {
print "$_\n";
}
The output looks like:
$ perl find_f_files.pl
/dir1/f2.dat
/dir1/f.dat
/dir1/subdir1/f2.dat
/dir1/subdir1/f.dat
/dir3/subdir3/f3.dat
I hope this helps.