Protoype Question With Error Related Help on Wrong Student Answer

#!/usr/local/bin/perl -- -*- C -*-
use CGI;
$query = new CGI;
print $query->header;
print $query->start_html("q1a.pl, Error Related Help Example");
print $query->start_form;
$ans = 5280;
$wrong_ans = 1/5280;
print "<P> How many feet are there in a mile?",
$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);
	if (eval (($stu_ans - $wrong_ans)**2  ) le 0.000001 ) 
		{print "<em>, was WRONG! Did you get the answer upside down?</EM>
		<IMG SRC=../icons/checkno.gif>"}
		elsif( (($stu_ans - $ans)**2  ) ge 0.01  )
		{print "<em>, was WRONG! </EM>
		<a href=./q1_help.pl>Do you want help?</a>"}
		 else {print "<em>, was RIGHT! </EM>
		<IMG SRC=../icons/check.gif>"};
};
print $query->end_html;



Click Here to see how this works and don't forget to input a WRONG answer. By the way, you might try `1/5280', and see what happens. You should also try 0.000189(39393939...).

There are several changes to the last program in order to understand what is going one here. First, we have added a `wrong_answer' i.e.,

$wrong_ans = 1/5280;
and we have altered the testing:
	if (eval (($stu_ans - $wrong_ans)**2  ) le 0.000001 ) 
		{print "<em>, was WRONG! Did you get the answer upside down?</EM>
		<IMG SRC=../icons/checkno.gif>"}
		elsif( (($stu_ans - $ans)**2  ) ge 0.01  )
		{print "<em>, was WRONG! </EM>
		<a href=./q1_help.pl>Do you want help?</a>"}
		 else {print "<em>, was RIGHT! </EM>
		<IMG SRC=../icons/check.gif>"};
};
What we have here is that first we check that the answer given is not 1/5280. Then, we check whether or not it is wrong in some other sense. If the student answered with 1/5280, the prompting message `Did you get the answer upside down' is given. If the student is just plain wrong, then the student is offered help (the old one, from the previous question). Only if the student is not wrong is the student then right, and gets the OK message.
Notice the spelling of elsif