i have this script/regex that's supposed to open a file (text or html) and search for an IP address on the page in the form of say: 209.245.56.103 and put it in a variable.
part of the script is written below. the regex may be inaccurate at this time, and the script shown is just for it to print the ip address just to confirm that i've read the IP address correctly. this is not the working version, as i still have to make a lot of changes. anyway my point is, no matter what i do, could not read the IP address in any way. what is returned is the decimal equivalent of a 32bit binary number (2 to the power of 32) which is equal to: 4294967296. any hint guys is really appreciated as i really have run out of options...
thanks in advance...
------------------------------------------------
#!/usr/bin/perl
$file = "ipaddress.html";
open(FILE,"<$file"
or die "Can't open file - $file - for reading";
print "Content-type: text/html\n\n";
print "<html><body>";
if ($ipnum = ~/^\d\d\d\.\d\d\d\.\d\d\d\.\d\d\d/)
{
print "$ipnum";
print "<br>";
}
print "</body></html>";
close(FILE);
-------------------------------------------------
part of the script is written below. the regex may be inaccurate at this time, and the script shown is just for it to print the ip address just to confirm that i've read the IP address correctly. this is not the working version, as i still have to make a lot of changes. anyway my point is, no matter what i do, could not read the IP address in any way. what is returned is the decimal equivalent of a 32bit binary number (2 to the power of 32) which is equal to: 4294967296. any hint guys is really appreciated as i really have run out of options...
thanks in advance...
------------------------------------------------
#!/usr/bin/perl
$file = "ipaddress.html";
open(FILE,"<$file"
print "Content-type: text/html\n\n";
print "<html><body>";
if ($ipnum = ~/^\d\d\d\.\d\d\d\.\d\d\d\.\d\d\d/)
{
print "$ipnum";
print "<br>";
}
print "</body></html>";
close(FILE);
-------------------------------------------------