Some comments:
opendir(DIRE, "/home/lenn287/public_html/diary"); my @files_exist = reverse sort map { $_ =~ s/^(\d+)\.html$/$1/; $_} grep { /^\w+.\.html$/} readdir DIRE; closedir DIRE;
Here your first regexp checks for (\w) and the second matches digits, so if you have a file called "bleh.html" it will pass the first grep but it will produce an empty entry on the display. Change the \w+ into \d+.
open my $FH,'<', '/home/lenn287/public_html/diary/'.$file_name.".html" +;
You don't check if your open succeeded or not.
for($first_file; $first_file<=$last_file;$first_file++) {
Since you're coding Perl:
for my $f ($first_file .. $last_file) {
On another note, since you want to search within the files, you should either create an index of some sorts, instead of opening each file and searching, or use a database to store the contents and then you can use fulltext search on them.
just a couple of cents
--In reply to Re: Need advices, displaying files in directory with CGI..
by Leviathan
in thread Need advices, displaying files in directory with CGI..
by doctor_moron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |