in reply to How to pattern match filenames in readdir?
Here's a solution that reads in one filename at a time, as your original code does.
The glob solution that runrig suggested, while (<*BLAH*>) {, also reads one filename at a time.opendir(DIR, "$dir") || die "can't open dir $dir: $!.\n"; while (defined(my $file = readdir DIR)) { next unless /BLAH/; do something; } closedir(DIR);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: How to pattern match filenames in readdir?
by tye (Sage) on Jun 05, 2001 at 23:05 UTC |