#!/usr/local/bin/perl use CGI; use HTML::Template ('get_template', 'parse_section'); my $query=new CGI; print $query->header(-type=>'text/html'); $usefile = $query->param('usefile') ; $template1 = 'index-source.html'; @sections = get_template($template1); $header = $sections[$i++][1]; $select_list = $sections[$i++][1]; $s2 = $sections[$i++][1]; $s3 = $sections[$i++][1]; $footer = $sections[$i++][1]; opendir ( SENDDIR, "send" ) ; @filelist = grep !/^\./, readdir ( SENDDIR ) ; closedir ( SENDDIR ) ; $print_string = parse_section ( $header ) ; print $print_string, "\n"; &print_select_list ; $print_string = parse_section ( $s2 ) ; print $print_string, "\n"; &print_select_list ; $print_string = parse_section ( $s3 ) ; print $print_string, "\n"; &print_select_list ; $print_string = parse_section ( $footer ) ; print $print_string, "\n"; sub print_select_list { foreach $filename ( @filelist ) { $selected = ( $usefile eq $filename ) ? "selected" : "" ; $print_string = parse_section ( $select_list ) ; print $print_string ; } }