+
+END
+
+; # starting to read in csv file, eat header line
+
+my ($number, $grade, $area, $desc, $ref, $station, $completion);
+my $incomplete="";
+my $complete="";
+my $templine;
+my $colon;
+my @stationbits;
+print "Progress: *";
+
+my $thisyear = -1;
+my $qmyear;
+
+# While loop which reads in each line of csv file
+while () {
+ chomp;
+ # Split single line into all the fields
+ ($number, $grade, $area, $desc, $ref, $station, $completion) = &parse_csv($_);
+
+ if (!$completion) { $completion = ""; }
+ $completion =~ s/\r//;
+ if (!$station) { $station = ""; }
+ if (!$ref) { $ref = ""; }
+ if (!$grade) { $grade = ""; }
+ if (!$desc) { $desc = ""; }
+ if (!$area) { $area = ""; }
+
+ if (($completion ne "") and ($ref ne ""))
+ {
+ print "\n?? Backlink for completed $number\n";
+ print "Ref is '$ref' and completion is '$completion'\n";
+ }
+ $qmyear = substr($number, 1, 4);
+ if($qmyear != $thisyear)
+ {
+ $complete = "$complete\n
$qmyear
\n";
+ $incomplete = "$incomplete\n
$qmyear
\n";
+ $thisyear = $qmyear;
+ }
+ # Last field of CSV file can have weird form-feeds etc. Kill them
+
+
+ # Construct XHTML line
+ if ($ref) {
+ $templine = "