{
    %allocated_ips = ();
    foreach my $domain (get_domains())
    {

        $OUT .= "# A Records for Hosts in $domain\n";
        foreach my $h ($hosts->get_hosts_by_domain($domain))
        {
            my $anIP = host2ip($h);

            my $prefixchar = '+';
            if ($anIP !~ /^\d+\.\d+\.\d+\.\d+$/)
            {
                $prefixchar = 'C';
            }
            else
            {
            my %reverse_lookups = get_reverse_lookup_choices();
            # If this IP is spoken for, then we know which host to use for the
            # reverse DNS lookup PTR.
            if (exists $reverse_lookups{$anIP})
            {
                my $reverse_host = $reverse_lookups{$anIP};
                if ($reverse_host eq $h->key)
                {
                    $prefixchar = '=';
                }
            }
            else
            {
                # Otherwise, we'll just use the first host that comes along.
                # Have we picked one already?
                unless (exists $allocated_ips{$anIP})
                {
                    $prefixchar = '=';
                }
            }
            # Note that this ip is taken.
            $allocated_ips{$anIP} = 1;

          }
            $OUT .= $prefixchar . $h->key . ":$anIP\n";
        }
        $OUT .= "\n";
    }
}
