#!/var/local/couch/bin/perl
&header;
@book= ({author=>"Musciano", title=>"HTML & XHTML: Definitive Guide", publisher=>"OReilly", year=>"2002",},
{author=>"Robbins", title=>"Unix in a Nutshell", publisher=>"OReilly", year=>"1999",},
{author=>"Anderson-Freed", title=>"Weaving a Website", publisher=>"Prentice Hall", year=>"2001",},
{author=>"Gosselin", title=>"Javascript", publisher=>"Thomas Learning", year=>"2000",},);
print "<table>\n";
for ($i=0; $i<4; $i++){
$authors = $book[$i]{author};
$titles = $book[$i]{title};
$publishers = $book[$i]{publisher};
$years = $book[$i]{year};

print "<tr><td>$authors</td>\n";
print "<td>$titles</td>\n";
print "<td>$publishers</td>\n";
print "<td>$years</td></tr>\n";}

%student = (
'Lisa' =>
{ year=>"Soph", dorm=>"Kerry", IDs=>"1, 2, 3, 4",},
'Alan' =>
{year=>"Frosh", dorm=>"McCain", IDs=>"1, 2",},
'Thuy' =>
{year=>"Junior", dorm=>"Bush", IDs=>"2, 3, 4",},
'Kim' =>
{year=>"Junior", dorm=>"Kerry", IDs=>"3, 4",},
'Brad' =>
{year=>"Frosh", dorm=>"McCain", IDs=>"4, 1, 3",},);

$LisaY= $student{'Lisa'}{year};
$LisaD= $student{'Lisa'}{dorm}; 
$LisaI= $student{'Lisa'}{IDs};
$AlanY= $student{'Alan'}{year}; 
$AlanD= $student{'Alan'}{dorm}; 
$AlanI= $student{'Alan'}{IDs};  
$ThuyY= $student{'Thuy'}{year}; 
$ThuyD= $student{'Thuy'}{dorm}; 
$ThuyI= $student{'Thuy'}{IDs};
$KimY= $student{'Kim'}{year}; 
$KimD= $student{'Kim'}{dorm}; 
$KimI= $student{'Kim'}{IDs};
$BradY= $student{'Brad'}{year}; 
$BradD= $student{'Brad'}{dorm}; 
$BradI= $student{'Brad'}{IDs};

print "<p><table><tr><td>Lisa</td><td> $LisaY </td><td>$LisaD</td><td> $LisaI </td></tr>\n";
print "<tr><td>Alan</td><td> $AlanY </td><td> $AlanD </td><td> $AlanI </td></tr>\n";
print "<tr><td>Thuy</td><td> $ThuyY </td><td> $ThuyD </td><td> $ThuyI </td></tr>\n";
print "<tr><td>Kim</td><td> $KimY </td><td> $KimD </td><td> $KimI </td></tr>\n";
print "<tr><td>Brad</td><td> $BradY </td><td> $BradD </td><td> $BradI </td></tr></table>\n";        

 
&footer;
exit(0);

 sub header
 {# print the header for the HTML page
    print "Content-type: text/html", "\n\n";
    print "<HTML><HEAD><TITLE></TITLE></HEAD>\n";
    print "<BODY BGCOLOR = 'white'>\n";
}

 sub footer
 {# print the footer for the html page
   print "</BODY></HTML>";
}