in reply to ARGV *.* importing problems

Also see the built-in glob, but this can have issues with whitespace, so File::Glob is usually safer.

Note that the glob construct *.* does not necessarily get all the files in the current directory, it only gets those whose names contain a dot. That will not include many files taken from UNIX, or most sub-directories (it is rare to see a dot in a directory name).

Replies are listed 'Best First'.
Re^2: ARGV *.* importing problems
by choroba (Cardinal) on Apr 30, 2011 at 21:34 UTC
    Also see the built-in glob, but this can have issues with whitespace, so File::Glob is usually safer.
    Safer? In the documentation you linked it says: Beginning with v5.6.0, this operator is implemented using the standard File::Glob extension.
      While it is true that the documentation says that, consider:
      my @files = glob('C:/Program Files/*'); print "@files\n";
      gives:
      C:/Program
      whereas:
      use File::Glob qw(glob); my @files = glob('C:/Program Files/*'); print "@files\n";
      gives:
      C:/Program Files/7-Zip C:/Program Files/ATI C:/Program Fil...
      etc. ad nauseum.
      This on ActiveState perl 5.12.3 64-bit Windows 7, but has been the same siince at least 5.6.0. I get similar results on Linux on 5.8.8.
        The documentation also says
        See File::Glob for details
        And if you do, you can see this:
        ## override the core glob (CORE::glob() does this automatically ## by default anyway, since v5.6.0) use File::Glob ':globally'; my @sources = <*.{c,h,y}>;
        But this piece of code does not behave like File::Glob::glob (namely, it does not call bsd_glob instead of glob). The question is: What exactly does CORE::glob automatically since 5.6.0 then?