#!/usr/bin/perl
#
# Author: Peter Keel <killer@discordia.ch>
# Intelligent whois. Gets whois-server automatically from TLD.
#
die "Usage: $0 domain\n"       unless($ARGV[0]);

$domain = @ARGV[0];
$tld = (split(/\.\b/,$domain))[1];
if ($tld eq "ch" || $tld eq "li") { $server="whois.nic.ch" }
    elsif ($tld eq "com" || $tld eq "net" || $tld eq "org") { $server="whois.internic.net" }
else { die "Unknown TLD\n" };


open (IN, "whois.real -h $server $domain|") || die "Could not execute whois.real\n";
while(<IN>){
print "$_";
    }
close IN;

    