Hmm, not sure I really understand what your problem is, but if you just want to discard all lines after __DISCARD__ tag (including that line itself), then you just need to add this code line in your while loop:
last if /^__DISCARD__/;
Now, the problem is that your program isn't doing anything useful with the data being read at this point. I would assume that you want to do something with the lines you are reading and that you don't filter out with your regexes, perhaps printing them to STDOUT or to a file, or possibly storing them in an array or something else for further processing.

In addition, just one minor comment:

next if $_ =~ /--.*/; next if $_ =~ /^SVSA.?/;
The .* and .? seem to be pointless here. You could have:
next if $_ =~ /--/; next if $_ =~ /^SVSA/;
which would yield the same results (except that this second version might probably be slightly more efficient, but that would be hardly noticeable, even with large input). This is really secondary, but it seems to indicate some misunderstandings in the comprehension of how regexes work. So, you are discarding lines matching --, presumably because -- might indicate the beginning of a comment (it does in some programming languages), but if this is the case, you should do it only if the -- comes at the beginning of the line, so that you might prefer something like this:
next if $_ =~ /^--/;
or possibly
next if $_ =~ /^\s*--/; # also removing lines having -- with some lead +ing white spaces
Similarly, discarding the "empty" lines might be better written:
next if $_ =~ /^\s*$/; # also removing lines with only white spaces


In reply to Re: discard lines after match by Laurent_R
in thread discard lines after match by teamassociated

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.