use File::Find; my $dir = # whatever you want the starting directory to be find(sub {print if -d}, $dir);