use CGI qw(:standard); print header(); print start_html('Resolved'); &resolve(); print param('xinput')." resolved to $new"; print end_html; #To resolve host names (xname) or IP(xip)... sub resolve{ if (param('xinput')=~/^\D/){ # if begins with a letter assume it's a name $new=join('.',(unpack("C4", gethostbyname(param('xinput'))))); }elsif (param('xinput')=~/^\d/){ # if begins with a number assume it's an IP $new=gethostbyaddr(pack("C4", (split(/\./, param('xinput')))), AF_INET); } if (($new eq null)||($new eq "")){ print "Could not resolve.\n"; die "Could not resolve.\n"; } } print "