@rem = '-*- Perl -*-'; @rem = ' @echo off C:\perl\bin\perl %0.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl '; ## multchoic.pl srand; if ($ENV{'REQUEST_METHOD'} eq 'GET'){ $ansdir = "../../../network/game"; $htmldir = "/network/game"; $cgidir = "/scripts/fcit/game"; $query = $ENV{'QUERY_STRING'}; ## Split the value Pairs @pairs = split(/&/, $query); ## Assign the name/value pairs to the $game associative array foreach $pair (@pairs){ ($name,$value) = split(/=/,$pair); $game{$name} = $value; } ##Split the Hist variable into an array for ($i = 25; $i >= 1;$i--){ $status[$i] = chop($game{HIST}); } $status[$game{CURR}] = 0; ##Assign the point value for the question if ($game{CURR} < 16){ $pointval = 30; }else{ $pointval = 40; } ##Open the testbank and load the testbank array open (TESTBANK,"$ansdir/multchoi.txt"|| die"can't open file"); $i=11; while(){ chop(); ($number,$question) = split(/=/); $testarray{$number} = $question; $i++; } ## Get the question and the answer from the array ($question,$answer[1],$answer[2],$answer[3],$answer[4])=split(/;/,$testarray{$game{CURR}}); html_header("Multiple Choice for $pointval points..."); print "
\n"; print "

$question

\n"; for($i=1;$i<=4;$i++){ print "
\n"; foreach $pair (@pairs){ ($name,$value) = split(/=/,$pair); print "\n"; } print "\n"; $corcode = 6*int(rand(10)); $incorcode = ($corcode+2); if (chop($answer[$i]) =~ /^\+/){ print "\n"; }else{ print "\n"; } print "
\n"; } print "
\n"; html_trailer; } sub html_header { $document_title = $_[0]; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print " $document_title \n"; print "\n"; print ''; print "\n

$document_title

\n"; } sub html_trailer { print "\n"; print "\n"; } __END__ :endofperl