Question : Help with my perl script

hello, I have this script but it fails to run. It was orginaly set to run on a unix box( See below), so I changed the path to my my windows path wihere my input file is located.

When I run it, it fails to look at my directory where the files are located.

My input file is located at c:\named.conf-rich

Can someone fix this so it will run on my windows box.

Thanks
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
#!/perl
 
unless ($ARGV[0])  {
    print "******************************************************\n";
    print "*                                                    *\n";
    print "*                                                    *\n";
    print "******************************************************\n";
    exit;
}
 
$inputfile=$ARGV[0];
$zonefound = 0;
 
open(INFILE, $inputfile) or die "Unable to find $inputfile\n";
@conf = ;
close INFILE;
 
foreach $linein (@conf)  {
    chomp($linein);
    $count++;
 
        if ($linein =~ /^zone\s+\".*in-addr.arpa\"/)  {
            $countZONE++;
            $zonefound = 1;
            ($j1, $j2, $j3, $j4, $j5) = split " ",$linein;
#print "ZONE-START: $linein\n";
        }
        elsif (($zonefound == 1) and ($linein =~ /^\}/))  {
            $zonefound = 0;
#print "  ZONE-END: $linein\n";
        }
        elsif (($zonefound == 1) and ($linein =~ /allow-update/))  {
print "$j2,$linein\n";
        }
        else {
                next;
        };
 
};
Open in New Window Select All

Answer : Help with my perl script

Cleaning up your code...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
#!/perl
 
$zonefound = 0;
@ARGV=;
 
while( $linein=<> ){
    chomp($linein);
    $count++;
    if ($linein =~ /^zone\s+\".*in-addr.arpa\"/)  {
        $countZONE++;
        $zonefound = 1;
        ($j1, $j2, $j3, $j4, $j5) = split " ",$linein;
    }
    elsif (($zonefound == 1) and ($linein =~ /^\}/))  {
        $zonefound = 0;
    }
    elsif (($zonefound == 1) and ($linein =~ /allow-update/))  {
        print "$j2,$linein\n";
    }
    else {
        next;
    }
}
Open in New Window Select All
Random Solutions  
 
programming4us programming4us