Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Reading Directory

by tokpela (Chaplain)
on Jul 14, 2009 at 09:25 UTC ( #779846=note: print w/replies, xml ) Need Help??


in reply to Reading Directory

I would also add that for scalability you should always iterate over a directory as opposed to pushing all of the filenames into an array.

I would also use a lexical directory handle.

my $dir = "/and/evel/aap/list/60"; opendir(my $d, $dir) || die "Unable to open $dir "; while (my $filename = readdir($d)) { # removes . and .. next if ($filename =~ /^\.+$/); my $filepath = "$dir/$filename"; ..... } closedir($d);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://779846]
help
Chatterbox?
[talexb]: So low end these days means quad core? Jeepers.
[jedikaiti]: 'mornin, Monks
[Corion]: talexb: Well, low end for desktops :-D
[marto]: hey jedikaiti

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-07-27 15:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (418 votes). Check out past polls.