I have a problem in a pl file. It does nog write information into an txt file as it should do.
Can someone debug this because I cant find the error. The rest works!
Her is the file ...
#!/usr/local/bin/perl
use CGI;
$q = new CGI;
$keuze = $q->param('plannen');
print "Content-type:text/html\n\n";
print "<html><head>";
print "<link href=\"../css/hodena.css\" type=\"text/css\" rel=\"StyleSheet\">";
print "</head>";
##### resultaten ophalen #####
open (INPUTFILE, "d:/inetpub/clubroot/hodena/js/weekendpoll.txt");
$plan1 = <INPUTFILE>;($plan1) = ($plan1 =~ /(.*)\W+/);
$vote1 = <INPUTFILE>;($vote1) = ($vote1 =~ /(.*)\W+/);
$plan2 = <INPUTFILE>;($plan2) = ($plan2 =~ /(.*)\W+/);
$vote2 = <INPUTFILE>;($vote2) = ($vote2 =~ /(.*)\W+/);
$plan3 = <INPUTFILE>;($plan3) = ($plan3 =~ /(.*)\W+/);
$vote3 = <INPUTFILE>;($vote3) = ($vote3 =~ /(.*)\W+/);
$plan4 = <INPUTFILE>;($plan4) = ($plan4 =~ /(.*)\W+/);
$vote4 = <INPUTFILE>;($vote4) = ($vote4 =~ /(.*)\W+/);
$plan5 = <INPUTFILE>;($plan5) = ($plan5 =~ /(.*)\W+/);
$vote5 = <INPUTFILE>;($vote5) = ($vote5 =~ /(.*)\W+/);
close INPUTFILE;
### resultaten aanpassen met nieuwe vote ###
if ( $keuze eq $plan1 ) { $vote1++; }
if ( $keuze eq $plan2 ) { $vote2++; }
if ( $keuze eq $plan3 ) { $vote3++; }
if ( $keuze eq $plan4 ) { $vote4++; }
if ( $keuze eq $plan5 ) { $vote5++; }
### resultaten wegschrijven ###
open (DATAFILE, "> d:/inetpub/clubroot/hodena/js/weekendpoll.txt");
print DATAFILE $plan1; print DATAFILE "\n";
print DATAFILE $vote1; print DATAFILE "\n";
print DATAFILE $plan2; print DATAFILE "\n";
print DATAFILE $vote2; print DATAFILE "\n";
print DATAFILE $plan3; print DATAFILE "\n";
print DATAFILE $vote3; print DATAFILE "\n";
print DATAFILE $plan4; print DATAFILE "\n";
print DATAFILE $vote4; print DATAFILE "\n";
print DATAFILE $plan5; print DATAFILE "\n";
print DATAFILE $vote5; print DATAFILE "\n";
close DATAFILE;
### screenoutput berekenen ###
$total = $vote1 + $vote2 + $vote3 + $vote4 + $vote5;
$percent1 = ((int(($vote1 / $total) * 1000)) / 10);
$percent1 = substr($percent1,0,4);
if ($vote1 < 1) { $percent1 = "0";}
$width1 = int($percent1 * 1);
if ($vote1 < 1) { $width1 = 2;}
$percent1 = "$percent1%";
$image_percent1 = "<IMG SRC=\"/hodena/figuren/bar.jpg\" Height=\"10\" Width=\"$width1\">";
$percent2 = ((int(($vote2 / $total) * 1000)) / 10);
$percent2 = substr($percent2,0,4);
if ($vote2 < 1) { $percent2 = "0";}
$width2 = int($percent2 * 1);
if ($vote2 < 1) { $width2 = 2;}
$percent2 = "$percent2%";
$image_percent2 = "<IMG SRC=\"/hodena/figuren/bar.jpg\" Height=\"10\" Width=\"$width2\">";
$percent3 = ((int(($vote3 / $total) * 1000)) / 10);
$percent3 = substr($percent3,0,4);
if ($vote3 < 1) { $percent3 = "0";}
$width3 = int($percent3 * 1);
if ($vote3 < 1) { $width3 = 2;}
$percent3 = "$percent3%";
$image_percent3 = "<IMG SRC=\"/hodena/figuren/bar.jpg\" Height=\"10\" Width=\"$width3\">";
$percent4 = ((int(($vote4 / $total) * 1000)) / 10);
$percent4 = substr($percent4,0,4);
if ($vote4 < 1) { $percent4 = "0";}
$width4 = int($percent4 * 1);
if ($vote4 < 1) { $width4 = 2;}
$percent4 = "$percent4%";
$image_percent4 = "<IMG SRC=\"/hodena/figuren/bar.jpg\" Height=\"10\" Width=\"$width4\">";
$percent5 = ((int(($vote5 / $total) * 1000)) / 10);
$percent5 = substr($percent5,0,4);
if ($vote5 < 1) { $percent5 = "0";}
$width5 = int($percent5 * 1);
if ($vote5 < 1) { $width5 = 2;}
$percent5 = "$percent5%";
$image_percent5 = "<IMG SRC=\"/hodena/figuren/bar.jpg\" Height=\"10\" Width=\"$width5\">";
print "<body bgcolor=#EFEFEF><p class=\"menu\">";
print "Stemming over de bestemming van het Hodena weekend 2004-05.<br><br>";
print "<table class=\"menu\">";
print "<tr><td>Kust<td>$image_percent1 $percent1</tr>";
print "<TR><td>Ardennen<td>$image_percent2 $percent2</tr>";
print "<TR><td>Kempen<td>$image_percent3 $percent3</tr>";
print "<TR><td>Voerstreek<td>$image_percent4 $percent4</tr>";
print "<TR><td>Brabant<td>$image_percent5 $percent5</tr>";
print "<TR><TD> </tr>";
print "<TR><TD>Total votes:<TD>$total</tr>";
print "</table>";
print "<\/body><\/html>";
exit;