http://www.perlmonks.org?node_id=277204

sunadmn has asked for the wisdom of the Perl Monks concerning the following question:

Good day all,
I have been trying for the last few days to get the PM Net::DNS::ZoneFile to work and am having some issues that I can not get around.
I was wondering if any of the monks have used this before or could help me with the specfic erros I am recieving. Following is my code and then the specfic errors I am recieving. Please forgive my ignorance as I am very new to the perl world.
#!/usr/bin/perl -w $| = 1; use strict; use File::Find; use FileHandle; use Net::DNS::ZoneFile; # use DNS::ZoneParse; use Data::Dumper; my $base = "/chroot/named/master/arpa/in-addr/68/168"; my $out_dir = "/var/tmp/ptr"; find(\&wanted, $base); exit; sub wanted { return unless ( -f "$File::Find::name" and $File::Find::name !~ m!/ +com/! ); return unless ( -f "$File::Find::name" and $File::Find::name !~ m!/ +net/! ); my $zone = $File::Find::name; my $out = join('.', ( split('/', $zone) )[-1,-2,-3]); my $rrset = Net::DNS::ZoneFile->readfh($zone[, $root]); # my $dns = DNS::ZoneParse->new("$zone"); open(OUT, ">$out_dir/$out") or die "Cant create $out_dir/$out: $!\n +"; print $_->string . "\n" for @$rrset; # print OUT Data::Dumper->Dump([$dns->ptr]) . "\n"; close(OUT); }
Error message:
[root@steve tmp] 738# perl -cwTM-strict ./ptr.pl Multidimensional syntax $zone[, $root] not supported at ./ptr.pl line +24. Global symbol "@zone" requires explicit package name at ./ptr.pl line +24. syntax error at ./ptr.pl line 24, near "[," Global symbol "$root" requires explicit package name at ./ptr.pl line +24. ./ptr.pl had compilation errors.