firewall00 has asked for the wisdom of the Perl Monks concerning the following question:
it works fine for the first time but i noticed somthing which make me confused#!/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 @array =<HAN> ; close(HAN); foreach my $x ( 0 .. $#array ){ if( $array[$x] =~ m/^zone\s+"$targetdomain"/ ){ for my $n (0 .. 4) { $array[$x+$n] = "//" . $array[$x+$n]; } } } open HAN, ">$file"; print HAN "@array"; close(HAN);
and after running itzone "domain.com" type master; file "/path/to/zone/domain.com"; notify yes; }; zone "mydomain.com" { type master file "/path/to/zone/mydomain.com"; notify yes }; zone "do.com" { type master; file "/path/to/zone/do.com"; notify yes; };
the script comment out the zone as i nedded but, you see the space added the left of the file and after run it again the spac is increased by one and so on . .zone "domain.com" type master; file "/path/to/zone/domain.com"; notify yes; }; //zone "mydomain.com" { //type master //file "/path/to/zone/mydomain.com"; //notify yes //}; zone "do.com" { type master; file "/path/to/zone/do.com"; notify yes; };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: After i made the script of commenting out lines , it starts to make bugs :S <<HELP!>>
by Corion (Patriarch) on Oct 07, 2007 at 16:58 UTC | |
Re: After i made the script of commenting out lines , it starts to make bugs :S <<HELP!>>
by strat (Canon) on Oct 08, 2007 at 10:25 UTC | |
by firewall00 (Acolyte) on Oct 09, 2007 at 08:43 UTC |