1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| #!/usr/bin/perl
use CGI;
$page = new CGI;
@tabfic= ();
opendir(rep,".");
while($lg = readdir(rep)){
if($lg=~ m/\.txt$/){
chomp($lg);
unshift(@tabfic,$lg);
}
}
closedir(rep);
print $page->header(),
$page->start_html(),
$page->h1("liste des fichiers txt"),
$page->startform(-name=>"f1",
-method=>"POST",
-action=>"affich.cgi");
print "<select name=\"s1\" multiple>";
for ($i=0;$i<=#tabfic;$i++) {
print"<option value=\"$tabfic[$i]\"> $tabfic[$i] </option>";
}
print "</select>";
print $page->submit(),
$page->end_form(),
$page->end_html();
exit; |
Partager