#!/usr/bin/perl 

open(FILE,"beerlist.txt") ; 
while ($_=<FILE>) {
   ( $beertype[++$i], $beer[$i] ) = m/(\S+)\s+(.*)/ ; 
}
close(FILE) ; 

open(FILE,"typelist.txt") ; 
while ($_=<FILE>) {
   ( $type[++$types], $typename[$types] ) = m/(\S+)\s+(.*)/ ; 
}
close(FILE) ; 

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

print "<html>\n";
print "<body>\n";

print "Debug info...\n" ; 
print join(" ", %beertype) ;

print "<form action=\"\">\n";

   for ($cnt=1; $cnt<=10; $cnt++) {
      print "<p>$cnt. $beer[$cnt] \n" ; 
      print "<select name=\"beer$cnt\">\n";
      for ($type=1; $type<=$types; $type++) {
         print "<option value=\"$type[$type]\">$typename[$type]</option>\n";         
      } 
      print "</select>\n";
   }

print "</form>\n";

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