use strict;
use warnings;
use Net::Whois;

$d = Net::Whois::Domain->new( "perl.org" )
    or die "Couldn't get information on $domain_name: $!\n";

print "The domain is called ", $d->domain, "\n";
print "Its tag is ", $d->tag, "\n";

print "Mail for ", $d->name, " should be sent to:\n";
print map { "\t$_\n" } $d->address;
print "\t", $d->country, "\n";

$contact_hash = $d->contacts;
if ($contact_hash) 
  {
  print "Contacts:\n";
  foreach $type (sort keys %$contact_hash) 
    {
    print "  $type:\n";
    foreach $line (@{$contact_hash->{$type}}) 
      { print "    $line\n"; }
    }
  }
else 
  { print "No contact information.\n"; }
