Thank you for your response. You are right it works as it is. However, here is my program and the program stops running when reaches the print "$tot1\n"; However, when I block out all the tot's equations, it runs again. Please help. Thanks.
#!/usr/bin/perl -w
use CGI;
$query = new CGI;
#pollr.cgi
$counti2=0;
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.
$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 $counti2 = $counti2 + 1;
$counti2++;
if ($media eq "WUPS"

{ $media1 = $media1 +1};
if ($media eq "WCZY"

{ $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 };
print "$count2i $comment<br>\n";
}
$tot1 = $media1/$count2i *100;
$tot2 = $media2/$count2i *100;
$tot3 = $media3/$count2i *100;
$tot4 = $media4/$count2i *100;
$tot5 = $media5/$count2i *100;
$tot6 = $media6/$count2i *100;
$tot7 = $media7/$count2i *100;
$tot8 = $media8/$count2i *100;
print "$tot1\n";
# Now we can print out a web page summarizing the data.
print <<EndHTML;
<html><head><title>Survey Results</title></head><body>
<h2 align=CENTER>Survey Results</h2>
Total visitors: $counti2<p>
Total number of blank Comments: $commentt<p>
<table width="40%" border=1><tr colspane=2><td width="40%">
How did you learn about this site?</td></tr>
<tr><td width="30%" > WUPS </td><td width="10%" > $media1</td> <td>$tot1</td> </tr>
<tr><td width="30%" > WCZY </td><td width="10%" > $media2</td> <td>$tot2</td></td> </tr>
<tr><td width="30%" > WMMI </td><td width="10%" > $media3</td> <td>$tot3</td></tr>
<tr><td width="30%" > Newpaper </td><td width="10%" > $media4</td> <td>$tot4</td></tr>
<tr><td width="30%" > Friend </td><td width="10%" > $media5</td> <td>$tot5</td></tr>
<tr><td width="30%" > Contacted </td><td width="10%" > $media6</td> <td>$tot6</td></tr>
<tr><td width="30%" > Billboard </td><td width="10%" > $media7</td> <td>$tot7</td></tr>
<tr><td width="30%" > Other </td><td width="10%" > $media8</td> <td>$tot8</td></tr> </table>
<br>
<table width="40%" border=1><tr colspane=2><td width="40%">
Why did you visit the website?</td></tr>
<tr><td width="30%"> Buy </td><td width="10%"> $reason1</td></tr>
<tr><td width="30%"> Sell </td><td width="10%"> $reason2</td></tr>
<tr><td width="30%"> Buy/Sell </td><td width="10%"> $reason3</td></tr>
<tr><td width="30%"> Curiosity </td><td width="10%"> $reason4</td></tr>
<tr><td width="30%"> Other </td><td width="10%"> $reason5</td></tr> </table>
<br>
<table width="40%" border=1><tr colspane=2><td width="40%">
What is your opinion of this website?</td></tr>
<tr><td width="30%"> Inexpensive - Easy </td><td width="10%"> $opinion1</td></tr>
<tr><td width="30%"> Expensive - Easy </td><td width="10%"> $opinion2</td></tr>
<tr><td width="30%"> Inexpensive - Hard </td><td width="10%"> $opinion3</td></tr>
<tr><td width="30%"> Expensive - Hard </td><td width="10%"> $opinion4</td></tr>
<tr><td width="30%"> No Opinion </td><td width="10%"> $opinion5</td></tr>
<tr><td width="30%"> Confused </td><td width="10%"> $opinion6</td></tr>
<tr><td width="30%"> Other </td><td width="10%"> $opinion7</td></tr>
</body></html>
EndHTML
sub dienice {
my($msg) = @_;
print "<h2>Error</h2>\n";
print $msg;
exit;
}