DOS Wildcards don’t play nice with Perl

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




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



expansion of the above steps:

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

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


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



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


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




See Also

Learning Perl Win 32
Win 32 Command Line



Category tags

Perl Programming WildCards win32