insta.gator has asked for the wisdom of the Perl Monks concerning the following question:
PERL noob here.
I need to load an array with file names produced from a wildcard search on a Windows box. I would like to pass the wildcard to the PERL script if possible. Not having luck. Here is what I have
use Cwd; my $dir = getcwd; opendir DIR, $dir; my @prfiles = grep { $_ eq $ARGV[0] && $_ ne '.' && $_ ne '..' } readd +ir DIR; closedir DIR;
I created using examples that I have found. I think that partially, my problem is with the wildcarding.
This is what I would like to do: "perl loadfiles.pl testfile*.dat". Assuming I have testfile1,2,3,4.dat in the directory, it would load the array with these file names.
Any help would be greatly appreciated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Loading an array with file names
by Corion (Patriarch) on May 04, 2015 at 20:28 UTC | |
|
Re: Loading an array with file names
by GotToBTru (Prior) on May 04, 2015 at 21:26 UTC | |
|
Re: Loading an array with file names
by jeffa (Bishop) on May 04, 2015 at 21:01 UTC | |
by graff (Chancellor) on May 05, 2015 at 05:09 UTC | |
|
Re: Loading an array with file names (Path::Tiny File::Find::Rule)
by Anonymous Monk on May 05, 2015 at 00:14 UTC | |
by Anonymous Monk on May 05, 2015 at 00:18 UTC | |
|
Re: Loading an array with file names
by edimusrex (Monk) on May 04, 2015 at 20:40 UTC |