DOS Wildcards don’t play nice with Perl

It’s a shell translation issue, going from DOS to C to Perl

 

See: http://www.xav.com/perl/lib/Pod/perlwin32.html

 

  1. install Wild.pm in Perl/Lib/
  2. set environment variable PERL5OPT=-MWild
  3. test

 

 

expansion of the above steps:

 

Wild.pm

Place the following in C:/Perl/Lib/Wild.pm (change location as required)

# Wild.pm - emulate shell @ARGV expansion on shells that don't
use File::DosGlob;
@ARGV = map {
             my @g = File::DosGlob::glob($_) if /[*?]/;
             @g ? @g : $_;
            } @ARGV;
1;

 

Environment Variable

Set the following Environment Variable

 

set PERL5OPT=-MWild (from the command-line)

 

See Programming.Environment Variable to set permanently for user or all users on machine

 

Test

perl -le "for (@ARGV) { print }" */*/*.pm

 

  • should generate a list that includes the above Wild.pm
  • you may need to adjust the dir path (*/*/ matches c:/Perl/lib/)

 

 

 

See Also

Win32
Learning Perl Win 32
Win 32 Command Line

 

 

Category tags

Perl Programming WildCards win32