first i would thank all the people who are in this forums cause they are very helpful ...,
By the way i had some posts hers about comment out the named.conf file the script is simply comment out the zones in the file and it works well
while i was testing scrpt i found that the script is working in an fixed way which means that the zone must be 5 lines if it not a five line the script won't function as needed ., Here is teh script
Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl -w
- use strict;
- print " please enter the domain name: ";
- my $targetdomain =<STDIN> ;
- chomp $targetdomain;
- my $file = "/home/adam/Desktop/hello";
- open HAN,$file || die "error opening file: $!";
- my @lines =<HAN> ;
- close(HAN);
- foreach my $x ( 0 .. $#lines ){
- if( $lines [$x] =~ m/^zone\s+"$targetdomain"/ ){
- for my $n ( 0 .. 4 ) {
- $lines[$x+$n] = "//" . $lines[$x+$n];
- }
- }
- }
- open HAN, ">$file";
- local $" = "";
- print HAN @lines;
- close(HAN);
i have tried many things
firt i have tried to make a variable which rally equals the last element
$v="}"; and i mae n from 0 .. $v and that failed
also i have tried to make another instance of the array like as i did in the first matching line
if( $lines [$y] =~ m/^};/ ){
and then make $n starts from 0 to the $lines [$]
any one can help me more and any help will be appreciated and thanks.