you method is depend on creating backup
No, it doesn't depend on that, it just does it. Changing that bit is trivial:
#!/usr/bin/perl -w
use strict;
print " please enter the domain name: ";
my $targetdomain = <STDIN>;
chomp $targetdomain;
my $file = "/home/blackice/hello";
open my $fh, '<', $file or die "Can't read '$file': $!\n";
my @array = <$fh>;
close $fh or die "Can't close file '$file' properly: $!\n";
my $comment = 0;
my $block = 0;
for (@array) {
if (/^zone\s+"$targetdomain"/) {
$comment++;
$block += () = /(\{)/g;
print $out '// '.$_; next;
}
if($comment) {
$block += () = /(\{)/g;
s!^!// ! if $comment or $block;
$block -= () = /(\})/g;
$comment = 0 unless $block;
}
}
open $fh, '>', $file or die "Can't write '$file': $!\n";
print $fh @array;
close $fh or die "Can't close file '$file' properly: $!\n";
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|