in reply to TLD lookup

this code will grab the root.zone file from NSI and give you a list of all the ICANN-sanctioned TLDs.
#!/usr/bin/perl -lw use LWP::Simple; use strict; use vars qw($ROOT_ZONE); $ROOT_ZONE = 'ftp://rs.internic.net/domain/root.zone'; my $data = get $ROOT_ZONE or die "Failed to fetch root zone\n"; my @lines = split /\r\n?|\n/, $data; my %tlds; for (@lines) { # ignore all but nameserver (NS) records next unless /\s+IN\s+NS\s+/; # grab the first "column" my ($tld) = split ' ', $_, 2; # ignore entries for the root zone next if $tld eq '.'; # strip off the trailing '.' and count the NS record ++$tlds{substr $tld, 0, -1}; } print for sort keys %tlds;