in reply to Re: Create a list of directories without . and ..
in thread Create a list of directories without . and ..
Great suggestion (I ++ed it already). One little flaw that catches me all the time: it breaks as soon as you do apply it to any directory but "./"
Easy to fix, though. Just be explicit about what directory you're opening.
my $dir = "."; opendir(DIR, $dir) or die "$dir: $!"; my @list = grep { -d "$dir/$_" and ! /^\./ } readdir(DIR); closedir(DIR);
"All you need is ignorance and confidence; then success is sure."-- Mark Twain
|
|---|