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