Thanks for your suggestions. Unfortunately File::File etc won’t work as we don’t want to change several 1,000 file specs ( sorry if some of the restriction seem arbitrary, but there are good reasons for them)
In the end we decided to use the file spec to pull back a super set of what we wanted. We then converted any '*' into '(.*?)' and did a regex. If $1 contains a '+' then we exclude the file e.g.
my $spec = ‘*_{process,read}_*’;
my $reg = $spec;
$reg =~ s/\*/(.*?)/g;
my @use;
for my $file ( glob $spec ) {
$file = m/$reg/;
push @use, $file unless $1 =~ /\+/;
}
Note: That’s a simplification of the code, which works, I haven’t tested or run the code above. It’s just for illustration here.
I suppose in the end it was a PERL question after all.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.