#!/usr/local/bin/perl --  # -*-Perl-*-

use Net::DNS;

while (1) {
         my $res   = Net::DNS::Resolver->new;
         my $query = $res->search("ftp.us.debian.org");

         if ($query) {
             foreach my $rr ($query->answer) {
                 next unless $rr->type eq "A";
                 print $rr->address, "\n";
		 last;
             }
         } else {
             warn "query failed: ", $res->errorstring, "\n";
         }
}
