The easiest conceptually may be to use a flag variable to tell when you're between the markers. Your code can then print a copy only when the lines are not between the flags. This will process line by line, so it should use relatively little memory regardless of the length of the file and the length of the excluded sections.
This smells a bit like homework but could be very usful to any random sysadmin, too. I'm going to put the actual code in a spoiler tag and hope you choose honorably based on your situation.
Another way is to slurp the data and use a multi-line regex replacement. That won't take too much memory if there aren't too many lines (for some values of "too much" and "too many"). Implementation is left as an exercise.
There are likely many more exotic ways to handle this as well, but one or the other of the ones already mentioned should work for you.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||