Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
more useful options
 
PerlMonks  

Re: How do I read a directory?

by cLive ;-) (Prior)
on Mar 30, 2001 at 05:37 UTC ( [id://68294]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to How do I read a directory?

Use the readdir function. To read only certain files, you can use it with grep. For example:

my $dir = '/path/to/dir'; # read all entries: opendir DIR, $dir or die "read dir $dir - $!"; my @dir = readdir DIR; closedir DIR; # read only cgi scripts: opendir DIR, $dir or die "read dir $dir - $!"; my @cgi_scripts = grep /\.cgi$/, readdir DIR; closedir DIR; # read all but (UNIX style) hidden entries: opendir DIR, $dir or die "read dir $dir - $!"; my @dir = grep !/^\./, readdir DIR; closedir DIR;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://68294]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.