Since a given IP address can have any number of domain names attached to it, you can't simply start with an IP address and hope to get a domain name at the end.
Fortunately, domaintools.com offers a service that may be close to what you're after.
For instance, try this link:
http://whois.domaintools.com/linuxquestions.com
You'll see info about this site, most of which you won't be interested in. But if you scroll down a bit, you'll see a link which reads "145,444 other sites hosted on this server". You have to register with them to use the feature, but once you've registered, you can click on that link and get a list of all domains on a server.
The downside is that you have to start with a domain name; starting with an IP address doesn't work. But once you've got one name for the server, you should be able to use this tool to find out all the others.
The link isn't there for all domains, and I haven't actually tried the tool myself, and I know it doesn't answer your question about writing it in Perl, but it's as close as I can find to what you're after.
Hope that helps