my @dirs = grep { /\w/ && -d "$dir/$_" } readdir($dh); #### my @dirs = grep { !/^\.\.?\z/ && -d "$dir/$_" } readdir($dh);