Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

shell regx

WinNT - DOS

User passes dos/win wild cards.
Short of using system(dir $arg) to collect file names
is there a module/switch to operate with the shell's understanding of "wild".  (Those '?' are killing
me)

Would really like to @f = grep 'shellWild' readdir(D);

0
hank1
Asked:
hank1
  • 2
  • 2
1 Solution
 
flivaudaCommented:
print "Please enter files to search for: ";
$args = <STDIN>; chop ($args);
open (FILES, "dir $args |");
while ($f = <FILES>)
{
 print "$f";
}
0
 
flivaudaCommented:
Actually I would use a dir /b if you just want the file names:

print "Please enter files to search for: ";
$args = <STDIN>; chop ($args);
open (FILES, "dir /b $args |");
while ($f = <FILES>)
{
 print "$f";
}

then you can set the $args value through code or user input.  Then put all the files into an array or whatever you need to do
0
 
hank1Author Commented:
Command line only.  I see there is nothing else.  Would have thought there
was a shell sense mod.  I got to get out of this java mode. Thanks.
0
 
ozoCommented:
Isn't the glob function implemented in your perl?
(of course it just does something similar to the above sysyem call anyway)
You might also look at sub fileglob_to_re in find2perl
0
 
hank1Author Commented:
Well lookie here... File::DosGlob.  Thanks to the omnipresent Mr OZO.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now