# All variables were initialized earliersub printMenu {	$letter =~ s/%20/ /g; # Put in a space instead of HTTP’s %20 entity	$str = "WHERE lastName LIKE '$letter%'"; # Lets me build a SQL SELECT statement to only look at records beginning with letter $letter		if ($letter eq '0') { $str = ""; $letter = "ALL RECORDS"; }	print "Content-type: text/html\n\n"; 	print <<EOFILE; # This is how I dynamically create web pages. I’ve never used CGI.pm. No  reason why not; I just never got in the habit.<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">$stylesheetlink<title>View House History Records by Name.</title></head><body><!-- # I know, I know—here I take the time to use a style sheet and yet I am still using tables. Old habits die hard… -- ><table>  <tr id="topBannerRow1">    <td class="topbannersides"><img src="/images/phhpicon.gif" alt="The Pullman House History Project" /></td>    <td class="topbannermiddle"><img src="/images/logo2.GIF" alt="Welcome to the Pullman Virtual Museum!" /></td>    <td class="topbannersides"><img src="/images/blhotelflorence.JPG" alt="The Hotel Florence" /></td>  </tr>  <tr id="topBannerRow2">    <td class="bottombannersides">The Virtual Museum</td>  <td class="bottombannermiddle">PULLMAN HOUSE HISTORY PROJECT</td>   <td class="bottombannersides">VIEW RECORDS BY NAME - $letter</td>  </tr></table><p /><h3 align="center">	<!-- # Displays an alphabet at the top. Each link calls this program with a new letter in the $letter variable --><a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=A">A</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=B">B</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=C">C</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=D">D</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=E">E</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=F">F</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=G">G</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=H">H</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=I">I</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=J">J</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=K">K</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=L">L</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=M">M</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=N">N</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=O">O</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=P">P</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=Q">Q</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=R">R</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=S">S</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=T">T</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=U">U</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=V">V</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=W">W</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=X">X</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=Y">Y</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=Z">Z</a> <a HREF="/cgi-bin/pvm/houseHistoryViewByName.pl?letter=0">ALL</a> 	</h3><p /><table>	<tr id="topBannerRow3">		<td class="middleBanner">Names</td>  	</tr></table><p /><table>EOFILE	$count = 0;# Pulls in the $str variable to fill in the limiting letter. This SELECT statement calls the records themselves from the census table.	$query = "SELECT * FROM census $str ORDER BY lastName, firstName";	my $sth = $dbh->prepare($query);	$sth->execute();	while (@ADDRESS = $sth->fetchrow()) { 		$address = $ADDRESS[0]; $aptNumber = $ADDRESS[1];		$dispstreet = $street = $ADDRESS[2]; $lastName = $ADDRESS[3];		$firstName = $ADDRESS[4]; $occupation = $ADDRESS[5];		$ownOrBoard = $ADDRESS[6]; $recordID = $ADDRESS[7];		$source = $ADDRESS[8]; $uid = $ADDRESS[8];	}			if ($firstName ne "") { $nameOfPerson = $lastName . ", " . $firstName }	else { $nameOfPerson = $lastName }		$count++;			$dispstreet =~ s/th//g;		if ($ownOrBoard eq "R") { $ownOrBoard = "Primary Renter." }		elsif ($ownOrBoard eq "B") { $ownOrBoard = "Boarder." }		elsif ($ownOrBoard eq "U") { $ownOrBoard = "" }		if ($source eq "1900 Census") { $recordID = "<a href=\"/cgi-bin/pvm/houseHistoryDisplay1900Census.pl?fileName=1900Census." . $recordID . ".xml\">More...</a>" }		else { $recordID = "" }		# This is the code that actually prints the names and addresses on the screen…		print <<WOMBAT;<tr>	<td class="nameCellOne">$nameOfPerson</td>	<td class="nameCellTwo"><a href="$urlStr">$address $street</a></td>	<td class="nameCellThree">$occupation</td>	<td class="nameCellOne">($source) $recordID</td></tr>WOMBAT	}	print "</table>\n";    getFooter();	$dbh->disconnect;	print "</body>\n</html>\n";