globbing

TorgoX on 2002-02-23T05:02:10

Dear Log,

So command.com doesn't glob:
C:\WINDOWS>perl -e "print qq(@ARGV)" *.txt
*.txt

Under Unixes, of course, you get "foo.txt bar.txt" etc. (Or you get an error: "No match".)

What does Cygwin do? And cmd.exe? Notably, is it safe for a program to assume that if $^O eq "MSWin32", @ARGV needs to be fed thru glob()?


Whinedows

gnat on 2002-02-23T08:58:51

I always tweak the programs I install on Windows, adding a line before the main program action that says:
@ARGV = map { glob } @ARGV;

That tip was brought to you by the good folks at perlmonks.

--Nat

Re:Whinedows

TorgoX on 2002-02-23T18:34:45

Do you know if that's just a command.com thing, or does cmd.exe and/or Cygwin require that hack too?

I note that glob() seems to use Unix globbing logic, not MSDOS globbing logic. I guess that's okay, even tho in theory one could type "*.[t-z]" and really mean all files ending in a literal ".[t-z]", as opposed to all files ending in a dot and any single letter t thru z.