use File::Slurp; my @dirs = grep { -d "$dir/$_" } read_dir($dir); #### my @dirs = grep { -d "$dir/$_" } read_dir($dir, keep_dot_dot=>1);