Yet another way..
use strict;
use warnings;
# Putting all of the zonefiles lised in named.conf into an array
my $srce = "named.conf.brian";
open(my $FH, $srce) or die "Failed to open file $srce ($!)";
my @files = map {
/"([^"]*)/; # get the filename
$1
} grep { /^\s*file / } <$FH>;
close($FH);
# Putting listing of all of the files in ~/zonefiles directory into a
+n array
# Assigning variable to directory
my $directory = "~/zonefiles";
opendir(D, "$directory") || die "Can't opendir $directory: $!\n";
my @list = grep { $_ !~ m/^(\.|\.\.)$/ } readdir(D);
closedir(D);
# Make hashes of the lists
my %configured = map { $_ => 1 } @files;
my %existing = map { $_ => 1 } @list;
print "Missing zone files:\n";
foreach my $file (@files) {
next if($existing{$file});
print "\t$file\n";
}
print "Unconfigured zone files:\n";
foreach my $file (@list) {
next if($configured{$file});
print "\t$file\n";
}