Re: Windows paths in glob
- From: Uri Guttman <uri@xxxxxxxxxxxxxxx>
- Date: Sun, 30 Mar 2008 23:20:48 GMT
"BM" == Ben Morrow <ben@xxxxxxxxxxxx> writes:
BM> Quoth Gunnar Hjalmarsson <noreply@xxxxxxxxx>:
>>
>> A long time ago I decided to use opendir() and readdir() instead of
>> glob(). It may not be as 'elegant', but it works flawlessly without
>> escaping spaces.
BM> To save Uri the trouble of pointing it out :), File::Slurp now has a
BM> read_dir function.
it has always had a read_dir function! its advantages are a simpler API
(no need for a handle, opendir, closedir calls) and it filters out . and
... for you. a minor disadvantage (and very minor IMO) is that it can't
iterate in scalar mode so you get one dir entry at a time. that would
only matter if your dir was enormous and i mean very big.
future plans include passing in a regex or code ref to filter for
you. yeah, you can use grep on the output but it is slightly shorter
that way.
uri
--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
.
- References:
- Windows paths in glob
- From: Dmitry
- Re: Windows paths in glob
- From: Gunnar Hjalmarsson
- Re: Windows paths in glob
- From: Ben Morrow
- Windows paths in glob
- Prev by Date: Re: Windows paths in glob
- Next by Date: FAQ 8.2 How come exec() doesn't return?
- Previous by thread: Re: Windows paths in glob
- Next by thread: Re: Windows paths in glob
- Index(es):