by the way the code you provide me didn't work
Which part didn't work? did you add some print statements to your code to see what each variable holds at each state of execution?
I suspect your main problem is
my $targetdomain = <STDIN>;
$targetdomain is a line from STDIN complete with the newline char. This will match your targetdomain only if it is written as
zone "foo.bar.com " {
and only if you read the file as one chunk and do a multiline match. So change that to
chomp (my $targetdomain = <STDIN>);
to remove the trailing newline.
update: To get help without suspecting, it is best to provide a complete set of data: input, program, expected output, actual output. Do so with the snippet that "didn't work".
--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}
In reply to Re^5: Deleting lines from named.conf file
by shmem
in thread Deleting lines from named.conf file
by firewall00
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |