I have the following data in a file:

ABC corp. 1 1002003 1002007 some text here 2 1011999 1012020 other text here XYZ Ltd. 1 2031994 2032071 some text here 2 2021996 2022030 other text here 1 1871995 1872031 some text here 2 1772004 1772021 other text here ...

and I need to match individual records in another file that start with a give id+year (e.g. 2032002) to its corresponding range per the data show above.

I have thought to load the data above into a record and then use that record to identify matches as I parse through the other data file. As matches are found I write the results to a results page that includes counts, company name, and the data (or some unique id that can be used to refer to the data).

I am fairly new to Perl and am finding it complicated to extract data out of my record... (which would look something like below):

@corps = ( { name => "ABC Corp.", ranges => [ { bid = "1022002", eid = "1022002", prefix = "102" }, { ... } ] }, { name => "XYZ Ltd.", ranges => [ { ... } ] } );

Reading the data file (sample in the top of email) and dynamically creating this record seems somewhat tricky but I was able to do it (I think). What I am having trouble with is printing the data (so I can check it is assigned correctly)! Help would be appreciated...

Cheers,
David

In reply to Records question by dave8775

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.