use File::Find::Rule; my @files = File::Find::Rule->file->maxdepth(1)->name('*.xml')->in( @dirs ); #### use Path::Class::Rule; my @files = Path::Class::Rule->new->file->max_depth(1)->name('*.xml')->all( @dirs );