#!/usr/bin/perl -w use strict; print " please enter the domain name: "; my $targetdomain = ; chomp $targetdomain; my $file = "/home/adam/Desktop/hello"; open HAN,$file || die "error opening file: $!"; my @array = ; 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); #### 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; }; #### 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; };