File::DosGlob

Provides a portable enhanced DOS-like globbing for the standard Perl distribution. DosGlob lets you use wildcards in directory paths, is case-insensitive, and accepts both backslashes and forward slashes (although you may have to double the backslashes). Can be run three ways:

  • From a Perl script:

    require 5.004
    use File::DosGlob 'glob';
    
    @perlfiles = glob  "..\pe?l/*.p?";
    print <..\pe?l/*.p?>;
  • With the perl command, on the command line:

    # From the command line (overrides only in main::)
    % perl -MFile::DosGlob=glob -e "print <../pe*/*p?>"
  • With the perlglob.bat program on the DOS command line:

    % perlglob ../pe*/*p?

When invoked as a program from the command line, File::DosGlob prints null-separated filenames to STDOUT.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.