use File::Find; my @files; find {no_chdir =>1, wanted => sub{-d and return; push @files,$_ } },@roots;