Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://131965]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-24 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found