Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TorgoX (1933)

TorgoX
  sburkeNO@SPAMcpan.org
http://search.cpan.org/~sburke/

"Il est beau comme la retractilité des serres des oiseaux rapaces [...] et surtout, comme la rencontre fortuite sur une table de dissection d'une machine à coudre et d'un parapluie !" -- Lautréamont

Journal of TorgoX (1933)

Saturday February 23, 2002
12:02 AM

globbing

[ #3062 ]
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()?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • 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 [perlmonks.org].

    --Nat

    • 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.