Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: File::Glob Ignores Dot Files

by Aristotle (Chancellor)
on Nov 26, 2003 at 11:10 UTC ( [id://310198]=note: print w/replies, xml ) Need Help??


in reply to File::Glob Ignores Dot Files

This is known, expected and desired behaviour. The proper glob pattern to include all files other than . and .. is {[^.],.[^.],.??*,*}

Makeshifts last the longest.

Replies are listed 'Best First'.
Re^2: File::Glob Ignores Dot Files
by jrw (Monk) on Sep 13, 2013 at 18:41 UTC
    The correct form of this glob pattern is really {.[!.],.??*,*}. Unfortunately, that has bugs in perl 5.8.8, although it works on 5.14 and 5.16. So, the actual best practice may be to avoid glob altogether and open a dirhandle yourself and read/filter the file names you get back.

      Nowadays I’d just use Path::Tiny and do path($to_dir)->children. It excludes . and .. automatically, which is a great default. It also spits out Path::Tiny objects full of useful convenience methods, rather than just strings, which help make code much less grubby.

      Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-11-05 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    chatterbot is...






    Results (30 votes). Check out past polls.