in reply to Re: Can I get help with Perl glob for filtering a directory
in thread Can I get help with Perl glob for filtering a directory
I'm trying to think of a SAFE way to wildcard the file and only get exact matches (except for case). I'm thinking maybe glob for
Then grep that list for files that match my original file length. Pretty tricky huh? I also read:myfilename*
and ^F for "case" ; upper/lower didn't seem to be discussed at all.https://metacpan.org/pod/Path%3A%3ATiny
I'm thinking of just using something like the old reliable albiet fugly:
my @f = grep /^\Q$fileName\E$/i,readdir D;
This whole endeavor of asking this was to get more skilled with glob(). It seems strange to me that part of glob() functionality is to return a subset of the set of files in a dir. That's exactly what I want to do - just different than a partial filename? That's why glob() seemed like a more natural approach to this requirement.
Larry said Perl makes the difficult easy and the impossible possible. In this case, it seems it's making Perl is making the easy, difficult! Just IMHO :)
TY sirs and ladies..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can I get help with Perl glob for filtering a directory
by NERDVANA (Priest) on Nov 06, 2023 at 19:23 UTC |