in reply to filtering file names to be added to an array...maybe.
You're on the right track. Rather than using the readdir bit, try using glob, as follows:
my @files = glob('*.dat');
Excellent job with the -w on the #! line! You should also add use strict; just under that. This will force you to declare your variables, among other things, so that's why my code snippet above uses my.
Chatterbox-inspired clarification: You can feed glob a path as part of its argument, like my @files = glob('/temp/*.dat'); Otherwise, glob acts on the current working directory.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: filtering file names to be added to an array...maybe.
by Coyote (Deacon) on Jun 06, 2001 at 09:26 UTC | |
by chipmunk (Parson) on Jun 06, 2001 at 19:36 UTC | |
by myocom (Deacon) on Jun 06, 2001 at 09:33 UTC | |
by Coyote (Deacon) on Jun 06, 2001 at 10:01 UTC | |
by sierrathedog04 (Hermit) on Jun 06, 2001 at 15:14 UTC |