Hello I just recently got back into Perl after several years without writing a single line of code so please bare with me. I will list my dilemma and hopefully someone can guide me in the right direction.
Output I am required to process: AAA_AA1_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) AAA_AA2_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) BS: 111_DDD, QE: QQQ_DDD (additionnal QE) BBB_BB1_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) BBB_BB2_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) BS: 222_DDD, QE: QQQ_DDD (additionnal QE) CCC_CC1_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) CCC_CC2_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) BS: 333_DDD, QE: QQQ_DDD (additionnal QE)
Lets call the lines with % queues so AAA_AA1_DDD has two sets of queues seperated by the pipe as do every other line save the lines that show a "BS:". In this example AAA_AA1_DDD belongs to BS: 111_DDD displayed 2 lines below it and CCC_CC2_DDD belongs to BS: 333_DDD. Unfortunately the output would have be nicer if it were reversed because I can check for a BS line mark is and add what the BS owns in a hash of arrays with the important values % and # of both queues. Something like:
BS 111_DDD => (AAA_AA1_DDD,%,#,%,#)
Why do I want to do this, well I think it would be the easiest way to populate a mysqldb
table queue BS queue_name in_q_per in_q_num out_q_per out_q_num ------------------------------------------------------------ 111_DDD AAA_AA1_DDD 0% 0 0% 0 111_DDD AAA_AA2_DDD 0% 0 0% 0 222_DDD BBB_BB1_DDD 0% 0 0% 0 222_DDD BBB_BB1_DDD 0% 0 0% 0 333_DDD CCC_CC1_DDD 0% 0 0% 0 333_DDD CCC_CC1_DDD 0% 0 0% 0
I thought of one way to do this 1) Put the output into an array and reverse the array to make it easier to process so the lines would look like this:
BS: 333_DDD, QE: QQQ_DDD (additionnal QE) CCC_CC2_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) CCC_CC1_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) BS: 222_DDD, QE: QQQ_DDD (additionnal QE) BBB_BB2_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) BBB_BB1_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) BS: 111_DDD, QE: QQQ_DDD (additionnal QE) AAA_AA2_DDD (0% / 0 of 1024 | event 0% / 0 of 1024) AAA_AA1_DDD (0% / 0 of 1024 | event 0% / 0 of 1024)
Please help me (with code examples if possible) decide a plan for this.

In reply to Plan of Attack. by NothingInCommon

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.