use File::Find; my @files; sub find_process { push @files, $File::Find::name if /\.xml$/; } find(\&find_process, 'C:/test'); ### Note: I'm not familiar with Windows pathing.