misterperl has asked for the wisdom of the Perl Monks concerning the following question:
which gets the job done, @F is correct, but its so wordy!die "oh snap\n" unless opendir D, $myDir; my @Fx = grep /^\w/,readdir I; closedir I; for ( @Fx ) { next if -d "$myDir/$"; push @F,$_; }
Can I use a ! -d "$myDir/$" somehow in the readdir line with the grep to do all my filtering at once?
TY wise ones.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How can I readdir and ! -d in one line
by Fletch (Bishop) on Oct 27, 2020 at 16:14 UTC | |
by misterperl (Friar) on Oct 27, 2020 at 17:22 UTC | |
by Fletch (Bishop) on Oct 27, 2020 at 17:46 UTC | |
|
Re: How can I readdir and ! -d in one line
by haukex (Archbishop) on Oct 28, 2020 at 21:17 UTC | |
|
Re: How can I readdir and ! -d in one line
by BillKSmith (Monsignor) on Oct 28, 2020 at 01:53 UTC | |
|
Re: How can I readdir and ! -d in one line
by Anonymous Monk on Oct 27, 2020 at 19:52 UTC | |
|
Re: How can I readdir and ! -d in one line
by Anonymous Monk on Oct 27, 2020 at 19:33 UTC | |
by Anonymous Monk on Nov 18, 2020 at 18:27 UTC |