Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

RE (3): Directory Listing

by tilly (Archbishop)
on Aug 10, 2000 at 02:22 UTC ( [id://27211]=note: print w/replies, xml ) Need Help??


in reply to RE: Re: Directory Listing
in thread Directory Listing

FWIW I avoid idioms like the above ever since I got bitten by the fact that globbing is a shell operation. Very few will notice, but I have been in the position of needing to do an emergency rewrite when I passed the maxium number of files in a directory that could be listed. (What that limit is depends on the shell Perl was built with. That time it was a bit over 3000.) While readdir() is much more verbose, with it I have no fears about being bitten again.

YMMV, warranty void where prohibited, etc.

UPDATE
jlp makes an excellent point below. I did not remember it, but once he said it I had a small bell go off. I had heard about that. Once 5.6.1 comes out I look forward to exploring what other goodness can be found therein.

Replies are listed 'Best First'.
RE: RE (3): Directory Listing
by jlp (Friar) on Aug 10, 2000 at 03:13 UTC
    "...I got bitten by the fact that globbing is a shell operation"

    This is true only in versions of perl prior to 5.6. In 5.6, globbing is implemented internally using File::Glob. My benchmarking shows glob() in 5.6 to be two orders of magnitude faster than in prior versions. Not only that, but it is also faster than the opendir(), readdir(), grep idiom. (yes, I am aware of your objections to 5.6, but I have yet to encounter any bugs, personally)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-23 18:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found