use CGI qw(:standard); print header; local $/ = "~\n"; $infile = param('file'); print start_html ( -title=>'quiz', -BGCOLOR=>'beige' ); print start_form ( -method=>'POST', -action=>"http://netlab/perl/obenberger/gradequiz.cgi" ); open (FILE, $infile) || die "Cannot open $infile: $!"; while () { chomp; ($type, $value) = split (/:/, $_); if ($type =~ m/q/i) { # ******* CHECKS FOR QUESTION LINE print "$value
"; } if ($type =~ m/a/i) { # ********* CHECKS FOR ANSWER LINE @answers = split (/,/, $value); $anslength = @answers; } if ($type =~ m/^s/) { # *** DETERMINES TYPE OF ANSWER BOX %selections = split (/,/, $value); @options = keys (%selections); if ($anslength > 1) { print checkbox_group(-name=>$type, -values=>\@options, -linebreak=>'true', -labels=>\%selections); }else { print "
"; print radio_group(-name=>$type, -values=>\@options, -linebreak=>'true', -labels=>\%selections, -default=>'-'); } print "


"; } } # ********** END WHILE STATEMENT close (FILE); print "
"; print submit (-value=>'Grade') . "   "; print reset (-value=>'Reset answers'); print "
"; print end_form; print end_html;