read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); #### use CGI; my $cgi = new CGI; my $var1 = $cgi->param('FORM_VAR_1'); #### $temp = "$table" . "ips" . ".txt"; $temp1 = "$table" . "results" . ".txt"; #### $temp = "${table}ips.txt"; $temp1 = "${table}results.txt"; #### open(TABLEIP, "<$temp"); while() { $thisline = $_; chomp($thisline); if($thisline == $ipaddress) { $IPcheck = 1; {last} } else { $IPcheck = 0; } } close(TABLEIP); #### use IO::File; .... $IPcheck = 0; { my $file = new IO::File "$temp", "r"; while (<$file>) { chomp; # operates on the $_ variable directly if ($_ eq $ipaddress) { $IPcheck = 1; last; } } } # note that you do not have to close the $file handle, falling # out of the scope and perl will automatically close the file. #### while() { $thisline = $_; $counter++; if($counter == 1) { $scoretotal = chomp($thisline); } if($counter == 2) { $votetotal = chomp($thisline); } if($counter > 2) { {last} } } #### while() { $counter++; chomp; $counter == 1 ? {$scoretotal = $_} : $counter == 2 ? {$votetotal = $_} : {last} }