in reply to How do I put all sub-directories into an array?
This is a bit LISPy, but it will work:
chdir "/home/www"; opendir DIR, "."; my @third_level_dirs = ( # 3. This tests for their presence grep { -d } ( # 2. This adds /logs to the end map { "$_/logs" } ( # 1. this returns all directories but . & .. grep { !/^\.\.?$/ && -d } (readdir DIR) ) ) ); closedir DIR;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I put all sub-directories into an array?
by Aristotle (Chancellor) on Jul 23, 2002 at 13:55 UTC | |
|
Re: Re: How do I put all sub-directories into an array?
by wylie (Novice) on Jul 24, 2002 at 08:40 UTC |