I have created the following program. However, it gives me the error at the end of the program.
#!/usr/bin/perl -w
use CGI;
$query = new CGI;
#pollr.cgi
$guest_file= "item2.out";
$counti2=0;
$counti2++;
$d ="\$";
print $query->header;
open(INF,"poll.out" or dienice("Couldn't open survey.out for reading: $! \n"
@data = <INF>;
close(INF);
# First we initialize some counters and hashes for storing the
# summarized data.
$count =0;
$commentary ="";
$media1 =0;
$media2 =0;
$media3 =0;
$media4 =0;
$media5 =0;
$media6 =0;
$media7 =0;
$media8 =0;
$reason1 =0;
$reason2 =0;
$reason3 =0;
$reason4 =0;
$reason5 =0;
$opinion1 =0;
$opinion2 =0;
$opinion3 =0;
$opinion4 =0;
$opinion5 =0;
$opinion6 =0;
$opinion7 =0;
$commentt =0;
foreach $i (@data) {
chomp($i);
($media,$reason,$opinion,$comment,$month,$day,$year)=split(/\|/,$i);
# this is the same as $count = $count + 1;
$counti2++;
if ($media eq "WUPS" { $media1 = $media1 +1};
if ($media eq "WCXY" { $media2 = $media2 +1};
if ($media eq "WMMI" { $media3 = $media3 +1};
if ($media eq "news" { $media4 = $media4 +1};
if ($media eq "Friend" { $media5 = $media5 +1};
if ($media eq "salebyyou" { $media6 = $media6 +1};
if ($media eq "billboard" { $media7 = $media7 +1};
if ($media eq "other" { $media8 = $media8 +1};
if ($reason eq "buy" { $reason1 = $reason1 +1};
if ($reason eq "sell" { $reason2 = $reason2 +1};
if ($reason eq "buysell" { $reason3 = $reason3 +1};
if ($reason eq "curiosity" { $reason4 = $reason4 +1};
if ($reason eq "other" { $reason5 = $reason5 +1};
if ($opinion eq "inexeasy" { $opinion1 = $opinion1 +1};
if ($opinion eq "inexhard" { $opinion2 = $opinion2 +1};
if ($opinion eq "expeasy" { $opinion3 = $opinion3 +1};
if ($opinion eq "exphard" { $opinion4 = $opinion4 +1};
if ($opinion eq "Noopin" { $opinion5 = $opinion5 +1};
if ($opinion eq "Confus" { $opinion6 = $opinion6 +1};
if ($opinion eq "Other" { $opinion7 = $opinion7 +1};
if ($comment eq " " { $commentt = $commentt + 1 };
# Now we can print out a web page summarizing the data.
<html><head><title>Survey Results</title></head><body>
<h2 align=CENTER>Survey Results</h2>
Total visitors: $counti2<p>
How did you learn about this site?
<ul>
<li> "WUPS =" $media1
<li> "WCZY =" $media2
<li> "WMMI =" $media3
<li> "Newpaper =" $media4
<li> "Friend =" $media5
<li> "Contacted =" $media6
<li> "Billboard =" $media7
<li> "Other =" $media8
</ul>
<ul>
<li> "Buy =" $media1
<li> "Sell =" $media2
<li> "Buy/Sell =" $media3
<li> "Curiosity =" $media4
<li> "other =" $media5
</ul>
<ul>
<li> "Inexpensive - Easy =" $opinion1
<li> "Inexpensive- Hard =" $opinion2
<li> "Expensive - Easy =" $opinion3
<li> "Expensive - Hard =" $opinion4
<li> "No Opinion =" $opinion5
<li> "Consfused =" $opinion6
<li> "Other =" $opinion7
</ul>
print <<EndHTML;
sub dienice {
my($msg) = @_;
print "<h2>Error</h2>\n";
print $msg;
exit;
}
ERROR IS:
Unquoted string "head" may clash with future reserved word at pollr.cgi line 81. Bareword found where operator expected at pollr.cgi line 81, near "
Please help.
#!/usr/bin/perl -w
use CGI;
$query = new CGI;
#pollr.cgi
$guest_file= "item2.out";
$counti2=0;
$counti2++;
$d ="\$";
print $query->header;
open(INF,"poll.out" or dienice("Couldn't open survey.out for reading: $! \n"
@data = <INF>;
close(INF);
# First we initialize some counters and hashes for storing the
# summarized data.
$count =0;
$commentary ="";
$media1 =0;
$media2 =0;
$media3 =0;
$media4 =0;
$media5 =0;
$media6 =0;
$media7 =0;
$media8 =0;
$reason1 =0;
$reason2 =0;
$reason3 =0;
$reason4 =0;
$reason5 =0;
$opinion1 =0;
$opinion2 =0;
$opinion3 =0;
$opinion4 =0;
$opinion5 =0;
$opinion6 =0;
$opinion7 =0;
$commentt =0;
foreach $i (@data) {
chomp($i);
($media,$reason,$opinion,$comment,$month,$day,$year)=split(/\|/,$i);
# this is the same as $count = $count + 1;
$counti2++;
if ($media eq "WUPS" { $media1 = $media1 +1};
if ($media eq "WCXY" { $media2 = $media2 +1};
if ($media eq "WMMI" { $media3 = $media3 +1};
if ($media eq "news" { $media4 = $media4 +1};
if ($media eq "Friend" { $media5 = $media5 +1};
if ($media eq "salebyyou" { $media6 = $media6 +1};
if ($media eq "billboard" { $media7 = $media7 +1};
if ($media eq "other" { $media8 = $media8 +1};
if ($reason eq "buy" { $reason1 = $reason1 +1};
if ($reason eq "sell" { $reason2 = $reason2 +1};
if ($reason eq "buysell" { $reason3 = $reason3 +1};
if ($reason eq "curiosity" { $reason4 = $reason4 +1};
if ($reason eq "other" { $reason5 = $reason5 +1};
if ($opinion eq "inexeasy" { $opinion1 = $opinion1 +1};
if ($opinion eq "inexhard" { $opinion2 = $opinion2 +1};
if ($opinion eq "expeasy" { $opinion3 = $opinion3 +1};
if ($opinion eq "exphard" { $opinion4 = $opinion4 +1};
if ($opinion eq "Noopin" { $opinion5 = $opinion5 +1};
if ($opinion eq "Confus" { $opinion6 = $opinion6 +1};
if ($opinion eq "Other" { $opinion7 = $opinion7 +1};
if ($comment eq " " { $commentt = $commentt + 1 };
# Now we can print out a web page summarizing the data.
<html><head><title>Survey Results</title></head><body>
<h2 align=CENTER>Survey Results</h2>
Total visitors: $counti2<p>
How did you learn about this site?
<ul>
<li> "WUPS =" $media1
<li> "WCZY =" $media2
<li> "WMMI =" $media3
<li> "Newpaper =" $media4
<li> "Friend =" $media5
<li> "Contacted =" $media6
<li> "Billboard =" $media7
<li> "Other =" $media8
</ul>
<ul>
<li> "Buy =" $media1
<li> "Sell =" $media2
<li> "Buy/Sell =" $media3
<li> "Curiosity =" $media4
<li> "other =" $media5
</ul>
<ul>
<li> "Inexpensive - Easy =" $opinion1
<li> "Inexpensive- Hard =" $opinion2
<li> "Expensive - Easy =" $opinion3
<li> "Expensive - Hard =" $opinion4
<li> "No Opinion =" $opinion5
<li> "Consfused =" $opinion6
<li> "Other =" $opinion7
</ul>
print <<EndHTML;
sub dienice {
my($msg) = @_;
print "<h2>Error</h2>\n";
print $msg;
exit;
}
ERROR IS:
Unquoted string "head" may clash with future reserved word at pollr.cgi line 81. Bareword found where operator expected at pollr.cgi line 81, near "
Please help.