Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: ARGV *.* importing problems

by choroba (Cardinal)
on Apr 30, 2011 at 21:34 UTC ( [id://902259]=note: print w/replies, xml ) Need Help??


in reply to Re: ARGV *.* importing problems
in thread ARGV *.* importing problems

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.

Replies are listed 'Best First'.
Re^3: ARGV *.* importing problems
by cdarke (Prior) on May 02, 2011 at 06:53 UTC
    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?
        Good point, but this brings us back to my original comment that File::Glob is safer. Whether that is how it should be is another question altogether.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://902259]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2024-04-23 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found