#!/usr/bin/perl # Putting all of the zonefiles lised in named.conf into an array use strict; use warnings; my $srce = "named.conf.brian"; my %zonefilenames; open(my $FH, "<", $srce) or die "Failed to open file $srce ($!)"; while (<$FH>){ next unless my ($filename) = m/file\s*"([^"]+)/; next if $filename eq "db.cache"; $zonefilenames{ $filename } =""; } close($FH); print "Zone Files: ",join( ", ", keys %zonefilenames)," \n"; # Putting listing of all of the files in ~/zonefiles directory into an array # Assigning variable to directory my $directory = "~/zonefiles/"; opendir(my $D, "$directory") or die "Can't opendir $directory: $!\n"; while ( readdir($D)){ next if m/^\./; # Ignore things with leading dots chomp; my $found = exists $zonefilenames{ $_ } ? "" : "Not found in zone definition"; print "$_ : $found\n"; } closedir($D);