There are two things here: there seems to be no Perl tool that will provide a simple solution to your problem and, I suspect, that this task is rather beyond your current programming abilities. While we can provide various suggestions and even substantial code, at the end of the day you have to be able to assimilate that information and use it to complete your task.

There are many ways to solve your problem. The regular expression based approaches offered so far are appropriate for the the fairly straight forward parsing/extraction problem you have presented and in fact if that is the exetent of your task then it has already been solved for you. I suspect though that the problem as expressed is actually a small part of a larger project that may be better tackled with heavier duty tools, which is why I mentioned Parse::RecDescent. However more powerful tools generally require more work to understand and use.

If you provide us with the larger picture we may be able to suggest an alternative way of tacking the bigger issue rather generating more frustration for everyone by trying to solve parts of it piecemeal and out of context.


DWIM is Perl's answer to Gödel

In reply to Re^5: Converting Oracle report language code into perl by GrandFather
in thread Converting Oracle report language code into perl by denzil_cactus

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.