Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How do I read all the file names of a directory into an array?

by peppiv (Curate)
on Dec 14, 2001 at 19:15 UTC ( #131965=note: print w/replies, xml ) Need Help??


in reply to How do I read all the file names of a directory into an array?

Working off of the array of file names, this is how I created a link to the file.
#!/usr/bin/perl print "Content-type: text/html\n\n"; opendir(INFILE, "dir.dat") || die ("Unable to open directory"); #this line gets rid of . and ..<br> @files = grep !/^\./, readdir(INFILE); closedir(INFILE); foreach $file (sort @files) { print ("<font size=\"2\"face=\"arial\"><a href=/owner/$file>$ +file</a></font>\n<br>"); }

peppiv
  • Comment on Re: How do I read all the file names of a directory into an array?
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2021-06-19 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (91 votes). Check out past polls.

    Notices?