#!perl -wT use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); my $q = new CGI; print $q->header; my $user = $q->param("user"); open (MATCHES, "matches.txt"); my @matches = ; close (MATCHES); open (DATA, "data.txt"); my @data = ; close (DATA); my %rankings; foreach my $line (@data) { my @entry = split /\*/, $line; $rankings{$entry[1]} = $entry[0]; } my ($x, $wins, $losses, @winners, @losers, @descriptions, @dates); $wins = $losses = 0; if (exists($rankings{$user})) { foreach my $match (@matches) { my @entry = split /\*/, $match; $wins++ if ($entry[0] eq $user); $losses++ if ($entry[1] eq $user); if ($entry[0] eq $user || $entry[1] eq $user && $x<10) { $winners[@winners] = $entry[0]; $losers[@losers] = $entry[1]; $descriptions[@descriptions] = $entry[2]; $dates[@dates] = $entry[3]; $x++; } } } print "

$user

\n"; print "

Wins: $wins    Losses: $losses

Last 10 Matches
"; print ""; print ""; for (my $i=0; $i<@winners; $i++) { print "\n"; } print "
DateWinnerLoserDescription
$dates[$i]$winners[$i]$losers[$i]$descriptions[$i]
\n"; print << "END_OF_MENU";
Sign Up Standings Report Loss
END_OF_MENU