in reply to Removing lines from a file.

Your logic is flawed. Instead of this:
if ($_ !~ /^zone \"$domain\" \{/ .. /\}\;/)
you should really have this:
unless (/^zone \"$domain\" \{/ .. /\}\;/)

Why? In your version you use the (/A/ .. /B/) syntax to extract a range of lines between /A/ being true and /B/ being true. When you test for ($_ !~ /A/ .. /B/) then you get everything between /A/ being false and /B/ being true. That's not what you want.

buckaduck

Replies are listed 'Best First'.
Re: Re: Removing lines from a file.
by mofo (Acolyte) on Apr 18, 2001 at 06:02 UTC
    Yes! You nailed it! That makes perfect sense now. I will use unless more often now instead of making my life difficult. You reply really helped me out!