#fill items from answer key
open(FILE,"key.txt");
@key=<FILE>;
close FILE;
#write submission to file to answer file and add a space between each character
foreach $item(@user){
open (FILE,">>$contents{'name'}.txt");
print FILE $item;
print FILE " ";
}
close FILE;
#load contents from submissions file
open (FILE,"$contents{'name'}.txt");
@submission=<FILE>;
close FILE;
my $i=0;
my $q=1;
for($i=0;$i<@submission;$i++){
print "<br />Question $q:";
if ($submission[$i] eq $key[$i]){
print "Correct";
}else{
print "Wrong. The correct answer is $key[$i]";
}
$q++;
}
The output I receive is:
Question 1:WRONG. --->The correct answer is 1966 False c d
What am I doing wrong or missing or not understanding?

New Topic/Question
Reply


MultiQuote





|