Zoogie has asked for the wisdom of the Perl Monks concerning the following question:
$area = "public/test/";
@files = ("*.txt", "_*");
The function should return something like:readme.txt, files.txt, _index, _sortopts, ... etc.I'm trying to use the glob function, but if you specify another directory, that directory name is prepended to every filename. Here's my current function:
@file_list =
map { /^$area(.*)/; $1 }
glob(join(' ',map { $area.$_ } @files));
Works as expected, but that seems like a lot more work
than necessary. Is there an easier / clearer / more
efficient way to do this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting a List of Files Via Glob
by merlyn (Sage) on May 28, 2000 at 10:20 UTC | |
by Zoogie (Curate) on May 30, 2000 at 21:14 UTC | |
by chromatic (Archbishop) on Jun 25, 2000 at 05:41 UTC | |
|
I don't use glob, I use readdir
by Corion (Patriarch) on May 29, 2000 at 13:52 UTC | |
by merlyn (Sage) on May 29, 2000 at 19:09 UTC | |
by t0mas (Priest) on May 30, 2000 at 13:46 UTC | |
by Corion (Patriarch) on May 30, 2000 at 15:12 UTC | |
by t0mas (Priest) on May 30, 2000 at 17:27 UTC | |
by Corion (Patriarch) on May 30, 2000 at 19:54 UTC | |
| |
by Zoogie (Curate) on May 30, 2000 at 21:09 UTC | |
by Corion (Patriarch) on May 30, 2000 at 21:53 UTC | |
|
Re: Getting a List of Files Via Glob
by BBQ (Curate) on May 29, 2000 at 19:32 UTC |