in reply to Re: Re: filtering file names to be added to an array...maybe.
in thread filtering file names to be added to an array...maybe.

As the docs say, it globs like /usr/sh would. And I tested this sort of glob on Win32 and it worked just fine.

Update: Excellent point, Coyote.

  • Comment on Re: Re: Re: filtering file names to be added to an array...maybe.

Replies are listed 'Best First'.
Splitting hairs
by Coyote (Deacon) on Jun 06, 2001 at 10:01 UTC
    There is a small issue with glob between Win32 and *nix. Consider a directory that contains files named "uc.DAT" and "lc.dat". Let's use this code to glob all files with an extension of dat on a linux box and a Win98 box (I don't have an NT box handy so YMMV).

    #!/usr/bin/perl -w use strict; use Data::Dumper; my @files = glob('*.dat'); print Dumper(\@files);
    Running this on linux yields this output:

    $VAR1 = [ 'lc.dat' ];
    On Windows 98, you get the following:

    $VAR1 = [ 'lc.dat', 'uc.DAT' ];

    The problem here is that Windows is case insensitive, but case preserving. This could be a potential problem if you are expecting the same output from glob on both platforms.

    ----
    Coyote