or download this
opendir(DIR, $dirname) || die "can't opendir $dirname: $!";
my @directory = readdir(DIR);
my @filenames = grep { -f "$dirname/$_" } @directory; # Either use th
+e array @directory, or rewinddir(DIR) here, and grep readdir(DIR) twi
+ce.
my @directories = grep {-d "$some_dir/$_" && !/^\.$/ && !/^\..$/} @di
+rectory;
closedir DIR;