#!/s/std/bin/perl -w

use strict;
use CSL::DBs;
use CSL::Sybase;
use CSL::Pg;
use DBI;
use Net::DNS;

my $dbhp = DBI->connect($CSL::DBs::csdb);
my %hash1;
my %hash2;

open("FH", "</s/dhcp/conf/dhcpd.conf") or die("Could not open the specified file: $!");

while (<FH>) {
  if ($_ =~ /host\s+(\w+)\s+\{/) {
    my $host = $1;
    $hash1{$host} = 1;
  }
}
close("FH");

open("FH", "</u/p/e/petska/splat/dhcpd.conf") or die("Could not open the specified file: $!");

while (<FH>) {
  if ($_ =~ /host\s+(\w+)\s+\{/) {
    my $dhost = $1;
    $hash2{$dhost} = 1;
  }
}
close("FH");

my @sorted;
foreach my $key (keys %hash1) {
  if (!$hash2{$key}) {
    push(@sorted, $key);
  }
}

@sorted = sort(@sorted);
foreach (@sorted) {
  my $res   = Net::DNS::Resolver->new;
  my $query = $res->search($_);
  print "$_\n" if ($query);
}
