#!/usr/bin/perl

$ext = '300';

$l = 'ncaalog300';

if (-e "football/hoopla/$l") {
    $count = 1;
    open (LOG, "football/hoopla/$l") or die "Can't open file:$!\n";
    while ($line = <LOG>) {
	chop $line;
	($first[$count], $last[$count], $bet[$count]) = split /\t/, $line;
	$count += 1;
    }
}

for $x (1..$#first) {
    $handle[$x] = join '',$first[$x],$last[$x],$ext,$bet[$x];
    $handle[$x] =~ tr/A-Z/a-z/;
}

for $x (1..$#bet) {
    if ($bet[$x] eq 'one') {
	$wage[$x] = '$';
    }
    else {$wage[$x] = ''}
}

print "Content-type: text/html\n\n";

print <<"HTML code";

<html>
<head>
<title>HooPLA 2003 Competition</title>
</head>

<body bgcolor=#663300 text=#FFFFFF link=#FFFFFF alink=#FFFFFF vlink=#FFFFFF>
<h2>HooPLA 2003 Competition</h2>
<p>
Click on any name to view that person's bracket.
<p>
<TABLE>
HTML code

    for $x (1..$#handle) {
print <<"HTML code";

<TR><TD><a href="http://ling.ohio-state.edu/~swinters/cgi-bin/bracket.pl?handle=$handle[$x]">$first[$x] $last[$x]</a><TD>$wage[$x]

HTML code

    }

print "</TABLE>\n";
print "</body>\n";

