Hello ,monks.
I have this text file:
I'll put numbers to it's lines.
1. Start context.
2. Some entry.
3. End context.
4. Start context.
5. Some different entry.
6. End context.

I try to eliminate the text in such way that the entry
between the closest START and END entries will be deleted.
The problem is that my script takes the first "Start
context" and goes trough the file until the last "End
context".

Here's a sample of what I use:
$ARGV[0]=$commandfile; $^I=".bak"; while(<>) { foreach $com (keys %hashnew) { if (/$hashnew{com}/../\*\ Exit\ conte +xt\ \*/) { s/$com//; } } print WFILE $_; }
What should I do.
Thank you very much.

Edited by Chady -- code tags.


In reply to File parsing-again by sashac88

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.