#!/usr/bin/perl
print "Content-Type: text/html\n\n";
my $host = gethostbyname($ENV{QUERY_STRING});
print $host ? "Got host $host\n" : "Choked!";
call it like:
http://yourdomain.com/cgi-bin/gethost?perlmonks.org
####
su nobody
./script.pl
##
##
./script.pl