#!/usr/local/bin/perl

sub recitation {
    local($num) = @_;
    return "Rec. <A HREF=\"homepage.html#REC$num\">$num</A>";
}

sub tutorial {
    local($num) = @_;
    return "Tut. <A HREF=\"homepage.html#TUT$num\">$num</A>";
}

print "<HTML>\n";
print "<HEAD>\n<TITLE>6.042 Recitation and Tutorial Assignments</TITLE>\n</HEAD>\n\n";
print "<BODY>\n\n<H1>Recitation and Tutorial Assignments</H1>\n\n";


print "<TABLE BORDER>\n";
print "<TR><TH>Name</TH><TH>Recitation</TH><TH>Tutorial</TH></TR>";

while (<>) {
    chop;
    local($last, $first, $email, $phone, $year, $rec, $tut) = split(/\t/,$_); 
    print "<TR>";
    print "<TD>", $last, ", ", $first, "</TD>";
    print "<TD>".&recitation($rec)."</TD>";
    print "<TD>".&tutorial($tut)."</TD>";
    print "</TR>\n";
}

print "</TABLE>\n";
print "</BODY>\n</HTML>\n";
