#!/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 .. 7) { if( $lines[$x+$n] =~ m/^\s};/ ){ last ; } $lines[$x+$n] = "//" . $lines[$x+$n]; } } } open HAN, ">$file"; print HAN $_ for @lines; close(HAN);
In reply to how to improve this script by firewall00
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |