chomp (my @dir = `ls $path`); #### my @list_of_directories = grep { -d "$path/$this_entry" } @dir;