Good catch on the backwhack, thanks! Fixed that typo, but the problem is still continuing. =/ I'd love to find a simpler way to do it, but this is the best way I could come up. Granted, I do have a tendency to over-complicate things.

So at this point in the script, the data is stored in a 3d array. @meta holds the pages, each page holds an array of lines, and each line points to an array of 3 values: Field Name, Field Type, and Field Details. Since it is originally raw text pulled from a pdf, each line is not necessarily a field's full information. Some field names are long enough to be split into two lines, and some of the field details can take up to 15 or 20 lines, but the field type is always only one line.

The script uses that to check if the line below the current one is the beginning of another field definition (field 0,1,2 defined) or a continuation of the current one (1 undefined, either/both 0/2 defined). If the latter it concats the lower line values onto the current line ($line_num) and then removes the lower line($line_num+1).

I tried using splice and undef, but that just leaves $line_num+1 undefined. I was hoping to get around that with sub del, so it could just concat and loop until a new definition (0,1,2 defined) was next, and then move down and repeat. It works great... until the end when the array of lines on the page starts growing.


In reply to Re^2: Undesired array growth by apok
in thread Undesired array growth by apok

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.