Guys,
Doing a simple little perl script that takes a list of IP addresses from a form textbox and then showing what country they are for. Only problem is the Perl only seems to process the last element of the array!!!
Anyone see what is wrong before I rip the last few tufts of hair out?
Form:
Perl code is:
Anything obvious???
Cheers!!
Doing a simple little perl script that takes a list of IP addresses from a form textbox and then showing what country they are for. Only problem is the Perl only seems to process the last element of the array!!!
Anyone see what is wrong before I rip the last few tufts of hair out?
Form:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>IP Country Checker</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<form action="getcountry.pl" method="POST">
<textarea cols="15" rows="4" name="ipaddresses"></textarea>
<input type="submit"><p>
</form>
</BODY>
</HTML>
[/FORM]
Perl code is:
Code:
#!/usr/bin/perl
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use IP::Country::Fast;
$input = param('ipaddresses');
@address = split /\cM\cJ/, $input;
print header();
print start_html();
foreach (@address)
{
$reg = IP::Country::Fast->new();
print $_." :: ".$reg->inet_atocc($_)."<br>";
}
print end_html();
Anything obvious???
Cheers!!