blackadder has asked for the wisdom of the Perl Monks concerning the following question:
It’s meant to obtain a list of directories. However when running this script it takes ages to populate the array with entries. And most of the directories are duplicated number of times. Does any one know the reason for this and is there a better way to obtain a list of directories quicker than this very slow method.use strict; use File::Find; my $path = shift @ARGV; my @dirs; find (sub {push @dirs, $File::Find::dir}, $path); foreach my $dir (@dirs){ print "$dir\n";}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Retrieving a List of directories only
by merlyn (Sage) on Jul 29, 2002 at 14:28 UTC | |
|
Re: Retrieving a List of directories only
by Abigail-II (Bishop) on Jul 29, 2002 at 14:35 UTC | |
|
Re: Retrieving a List of directories only
by broquaint (Abbot) on Jul 29, 2002 at 15:24 UTC | |
|
Re: Retrieving a List of directories only
by particle (Vicar) on Jul 29, 2002 at 14:42 UTC | |
by blackadder (Hermit) on Jul 29, 2002 at 15:14 UTC |