http://qs321.pair.com?node_id=179995


in reply to Re: Find and Print Directory Names
in thread s and replace

Why does this only print out one direcotry
@alldir = finddir("$config{home}$user{site_id}"); print "@alldir"; sub finddir { $root = shift; chomp ( $root ); $root = $root . '/' unless ( $root =~ m|/$| ); local *DIR; opendir ( DIR, $root ); my @userfiles = sort grep !/^\.\.?\z/, readdir DIR; foreach $file (@userfiles) { next unless ( -d "$root$file" ); $dir = "$root$file"; $dir =~ s/^\Q$config{home}$user{site_id}\E//; push(@direct, $dir); finddir("$root$file"); } return "@direct"; }