#!/usr/bin/perl -w
use strict;
use Getopt::Long;
((my $progname = $0) =~ s/^.*(\/|\\)//ig); # basename $0
# Parse options
my $no_verbose_progress = 0;
my $usage = 0;
GetOptions('quiet' => \$no_verbose_progress, # be quiet
'help|?' => \$usage # help!
);
# Print usage
if ($usage) {
usage();
}
unless ($ARGV[0]) {
print "Specify a CSV file name as the program's argument (e.g. glossary.csv)\n";
usage();
}
open (CSV, "< $ARGV[0]");
# Start writing table file, and write table header
open TABLE, "> atoz.html" or die $!;
print TABLE << "END";
1623:204 Passage Names Glossary
Steinbrückenhöhle Passage Names Glossary
A -- B -- C --
D -- E -- F --
G -- H -- I --
J -- K -- L --
M -- N -- O --
P -- Q -- R --
S -- T -- U --
V -- W -- X --
Y -- Z
END
; # starting to read in csv file, eat header line
my ($name, $file, $fragment, $desc, $ety);
my $output="";
my $templine;
my $lcletter;
my $letter = "";
unless ($no_verbose_progress) {
print "Progress: *";
}
my %areanames =
("ariston.html", "Deep South",
"entrance.html", "Near End",
"midlevel.html", "Midlevel",
"millennium.html", "Millennium",
"nopain.html", "NPNG / Pleasuredome",
"rhino.html", "Rhino",
"swings.html", "Swings",
"treeumphant.html", "Tree",
"uworld.html", "Gaffered / Underworld",
"subsoil.html", "Subsoil");
# While loop which reads in each line of csv file
while () {
chomp;
# Split single line into all the fields
($name, $file, $fragment, $desc) = &parse_csv($_);
# Last field of CSV file can have weird form-feeds etc. Kill them
$desc =~ s/\r//;
if(uc(substr($name, 0, 1)) ne $letter)
{
$letter = uc(substr($name, 0, 1));
$lcletter = lc($letter);
$output = "$output