use CGI; use Net::Whois::ARIN; use Regexp::Common qw /net/; my $w = Net::Whois::ARIN->new( host => 'whois.arin.net', port => 43, timeout => 30, ); print "content-type:text/html; charset=utf-8\n\n"; print $head; my $q = new CGI; my $ip = $q->param('ip'); if (!$ip){print $formm; }else{ my @records = $w->network($ip=~ /^$RE{net}{IPv4}$/); foreach my $net (@records) { # print ...; } }