#!/usr/bin/perl
use CGI qw(:standard);
my ($name) = param("name");
my ($userchoice) = param("userchoice");
if ($name eq "userchoice")
{
$name = $userchoice;
}
print "Content-type: text/html\n\n";
$holdMe = makeHTML($name);
if ($holdMe)
{
print($holdMe);
}
else
{
print "
Search ErrorThere was an error.
";
}
############################################################
sub makeHTML
{
my ($newname) = @_;
open (TEMP, "namefile.txt") || return ("1");
while ()
{
if (m/1/gi)
{
$nameList1 = "namelist1.txt";
$nameList2 = "namelist2.txt";
}
else
{
$nameList1 = "namelist2.txt";
$nameList2 = "namelist1.txt";
}
}
close (TEMP);
open (TEMP, ">namefile.txt") || return ("1");
print (TEMP "$nameList2");
close (TEMP);
open (LISTIN, "$nameList1") || return ("2");
open (LISTOUT, ">$nameList2") || return ("3");
$stringOut = "Bak Boy #4 Baby Name Survey";
$stringOut .= "Bak Boy #4 Baby Name Survey
";
$stringOut .= "";
$stringOut .= "";
$stringOut .= "