Perl Problem
Hello all,I am having trouble getting a little snippet of code to work properly. Bear in mind, the same code has worked before it is:
The script is to log the IP and compare it to a list of IPs. When I compare it though, it returns as unique each time, even though the IP is the same(yes, I checked for this). I have tried many ways around it like =, eq, =~ and ne but to no avail, I always get an inconsistant result. Any help would be greatly appreciated.
sub new {
$pro = $formdata{'pro'};
$IP = $ENV{'REMOTE_ADDR'};
$IP =~ s/\.//g;
open (LOG, "<$pro.ip");
flock (LOG,2);
@lines = <LOG>;
foreach $lines(@lines) {
if ($lines = $IP) {
print "Content-type: text/html\n\n";
print "You have already rated this script";
$proceed = "n";
}
}
close (LOG);
if ($proceed ne "n") {
open (FILE, ">$pro.ip");
flock (FILE,2);
print FILE "$IP\n";
foreach $lines(@lines) {
print FILE "$lines";
}
close (FILE);
&procnew;
}
}