#!/usr/local/bin/perl
# phone.pl
# Invoke the perl compiler


# Define the location of the phone database
$PHONEBOOK="/export/home/httpd/cgi-bin/phone.txt";	



# Define the path to cgiparse
$CGIPATH="/export/home/httpd/cgi-bin";	
# Convert form data to variables
eval `$CGIPATH/cgiparse -form -prefix $`;	

# Send results to browser
print <<EOM;	
Content-type: text/html

<TITLE>Phone Book Search</TITLE>
<BODY>
<H1>Phone Book Search</H1>
<p><hr><p>
EOM

#Echo the original query, do a case-insensitive search, and print results
print <<EOM;
Search for <B>$query</B> yields these entries:	
<PRE>
EOM

print `grep -i $query $PHONEBOOK`;	



print <<EOM;
</PRE>
</BODY>
EOM
