use File::Find::Rule qw(find); my @subdirs = find 'directory', in => $directory; my @files = find 'file', name => '*.pm', in => \@INC;