I think you'll have to loop
use File::Find;
my $limit= 4; # Whatever you prefer
for ($name = 1; $name <= $limit; ++$name) {
find(\&Wanted, $dir);
}
This will go through all subdirectories and search 1.* first, then 2.*, then 3.* and at last 4.* or whatever you defined as a $limit.
sub Wanted {
# /$name\.*/;
# NO! You want $name at the beginning!
Update... Made a mistake
/^$name\./;
if (/^$name\./) {
# if undef {
If what is undef?
What you pretend to do is, increment $name if $name is not in the directory. What you really would do if it worked is: increment $name if the FIRST NAME in the directory doesn't match. It won't match since the first name would (in *NIX) almost always be "."
# $name++;
# return;
# } else {
open(FILE, $_);
my @lines = <FILE>;
# some processing missing here?
}
}
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.