could anyone help me finish this program.
i need to write a program which reads the file structure of a directory and prints out a list of all the html files in order( i have done this part) but then i need to be able to use that list so any one of the files can be selected through a html web page and this is the bit that is giving me trouble.
sorry if i havent explained it well.
heres the code:
#!/usr/bin/perl -w
use IO::Dir;
use CGI;
my @fileList;
$dir = IO::Dir->new(".");
if (defined $dir)
{
while (defined($_ = $dir->read))
{
if (/\.html$/)
{
push @fileList, $_;
}
}
}
@fileList = sort {uc($a) cmp uc($b)} @fileList;
my $cgi = new CGI;
print $cgi->header();
print $cgi->start_html;
print "<form name="List Dir" method="post" action="">";
print "<select name="select">";
foreach my $file (@fileList)
{
print <option value=$file>$file</option>;
}
print "</select>";
print "</form>";
print $cgi->end_html;
}