kingjamesid has asked for the wisdom of the Perl Monks concerning the following question:
I am performing a recursive fn.
But I need to say, based on a dir (argument to readFiles), check if there is any other dir, if so readFiles again. My question is, what is the command in perl that "checks if there is a directory in a given path). Thanks.sub readFiles { my $ipath = $_[0]; my $afile; opendir(sDir, $ipath) || die "unable to open sDir: $!"; my @files = grep { /\.mat$/ } readdir(sDir); foreach (@files){ print FILE "$ipath\\$_"."\n"; } closedir(sDir); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Directory available?
by Corion (Patriarch) on Oct 19, 2009 at 16:57 UTC | |
|
Re: Directory available?
by ph0enix (Friar) on Oct 20, 2009 at 07:53 UTC | |
by kingjamesid (Acolyte) on Oct 24, 2009 at 23:56 UTC | |
by afoken (Chancellor) on Oct 25, 2009 at 08:52 UTC |