Commit 8a95906e authored by Robert Ricci's avatar Robert Ricci

Bugfixes to total-score

Fix multiple 'total' lines

Newline at end of final line
parent 56c6fd76
......@@ -9,7 +9,7 @@ close(SCORE);
my $total = 0;
my $total_possible = 0;
my $found_totalline;
my $found_totalline = 0;
foreach my $line (@scorefile) {
if ($line =~ /^\s*(\d+|XX)(\s*\/\s*(\d+)\s*)?/) {
......@@ -23,6 +23,7 @@ foreach my $line (@scorefile) {
$total_possible += $possible;
}
} elsif ($line =~ /^\s*Total:\s*(XX|\d+)?\s*\/\s*(YY|\d+)?/) {
$found_totalline = 1;
$line = "Total: $total / $total_possible\n";
print $line;
}
......@@ -40,5 +41,5 @@ if (!$found_totalline) {
open(SCORE,">$SCOREFILE") or die "Unable to write to $SCOREFILE: $!\n";
print SCORE join("\n",@scorefile);
print SCORE map {"$_\n"} @scorefile;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment