Saturday, December 06, 2008

Today I'm Hoping to Deal with the Spreadsheets Full of Clicker Grades


#!/usr/bin/perl

$totalasked=0;
$count=1;


for($day=1; $day<23; $day++) {

open (SCORES, "day$day.csv") or die $!;

chomp($line=);
@array = split (/,/, $line);

foreach $entry (@array)
{
if ($entry ne undef){
$totalasked+=1;
}
}


while ($line=) {
@array=split(/,/, $line);
$number_attempted = 0;
$lastname = shift(@array);
$firstname = shift(@array);
$idnumber = shift(@array);
$padnumber = shift(@array);
$padserial = shift(@array);
pop @array;
$number_correct = pop(@array);
foreach $response (@array)
{
if ($response ne undef){
$number_attempted +=1;
}
}

$student[$padnumber][0] = $lastname;
$student[$padnumber][1] = $firstname;
$student[$padnumber][2] = $idnumber;
$student[$padnumber][3] += $number_correct;
$student[$padnumber][4] += $number_attempted;

}

close(SCORES);

}

print "The total asked was: $totalasked.\n\n";

for $i (0 .. $#student)
{
print "$i,";
for $j (0 .. $#{$student[$i]}){
print "$student[$i][$j],";
}
print"\n";
}