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 and $ref)
{
print "\n?? Backlink for completed $number\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
$completion =~ s/\r//;
# Construct XHTML line
if ($ref) {
$templine = "