I would like to run a perl script to find only subdirectories in a directory. I would not want to have a "." and ".." is back.
The program I'm trying to use is as follows:
use warnings; use strict; my $root = "mydirectoryname"; opendir my $dh, $root or die "$0: opendir: $!"; while (defined(my $name = readdir $dh)) { next unless -d "$root/$name"; print "$name\n"; }
The result of this, however, is ".". and "..". How can I exclude them from the list?
Sundar
source share