mapg
02-21-2005, 04:46 PM
Hi All,
I would like to know if there is an easy way to split this array (a file list in this case) in multiple pages. I have summarized the code to clarify the main function.
##!/usr/bin/perl
print "Content-type: text/html\n\n";
sub get_file_list {
$total_files = 0;
opendir(DIR, ".");
@files = readdir(DIR);
@files = sort { lc($a) cmp lc($b) } @files;
closedir(DIR);
for my $file (@files) {
if (($file eq ".") || ($file eq "..")) {
next;
}
print $file, "<br>";
$total_files++;
}
}
&get_file_list;The limits could be inserted in the QUERY_STRING environment
I appreciate a lot any idea because I really need to split this array because is growing impressively with 1000's files.
Thank you very much in advance.
Mapg
I would like to know if there is an easy way to split this array (a file list in this case) in multiple pages. I have summarized the code to clarify the main function.
##!/usr/bin/perl
print "Content-type: text/html\n\n";
sub get_file_list {
$total_files = 0;
opendir(DIR, ".");
@files = readdir(DIR);
@files = sort { lc($a) cmp lc($b) } @files;
closedir(DIR);
for my $file (@files) {
if (($file eq ".") || ($file eq "..")) {
next;
}
print $file, "<br>";
$total_files++;
}
}
&get_file_list;The limits could be inserted in the QUERY_STRING environment
I appreciate a lot any idea because I really need to split this array because is growing impressively with 1000's files.
Thank you very much in advance.
Mapg