Non the less, here is the free form numerical alternative input example.
#!/usr/local/bin/perl -- -*- C -*- use CGI; $query = new CGI; $quest = 3.4; $debug = "true"; print $query->header; print $query->start_html("q2.pl, Numerical Input Example"); print $query->start_form; print <<EOF; <P> How many feet are there in $quest miles? EOF $ans = 5280*$quest; print $query->textfield('stu_ans','',10,30); print "<P> Is the above answer correct?",$query->submit("Send Answer in For Grading"); print $query->reset; print $query->end_form; $returned_ans = $query->param('stu_ans'); if ( $query->param('stu_ans') ne '') { print "<em>Student_answer, </em>$returned_ans"; $returned_ans =~ s/\//gi; $returned_ans =~ s/\$//gi; $returned_ans =~ s/#//gi; $returned_ans =~ s/~//gi; $stu_ans = eval($returned_ans); $criterion = ($stu_ans - $ans)**2; if($debug eq "true"){ print "<br>Actual answer recorded in question = ",$ans; print "<br> Criterion for acceptance = ",$criterion; } print "<br> student answer = ",$returned_ans; if ( (($stu_ans - $ans)**2 ) ge 0.01 ) {print "<em>, was WRONG!</EM> <IMG SRC=../icons/checkno.gif>"} else {print "<em>, was RIGHT! </EM> <IMG SRC=../icons/check.gif>"}; }; print $query->end_html;Click Here to see this Alternative Numerical Input Example.
Some random comments:
$returned_ans =~ s/\//gi; $returned_ans =~ s/\$//gi; $returned_ans =~ s/#//gi; $returned_ans =~ s/~//gi; $stu_ans = eval($returned_ans);