Hi monks

This one is a bit problematic. I need to read a file into a data structure that enables quick sorting, searching etc. The data look like this:

AAAAAAA p 1 6 1105720 2453315 1106720 2453315 1106720 2453950 1106715 2453950 1106715 2454525 1105720 2454525 p 2 6 1105720 2456125 1106720 2456125 1106720 2456760 1106715 2456760 1106715 2457335 1105720 2457335 p 3 6 1105720 2458940 1106720 2458940 1106720 2459575 1106715 2459575 1106715 2460150 1105720 2460150 BBBBBBB p 1 6 1105720 2461750 1106720 2461750 1106720 2462385 1106715 2462385 1106715 2462960 1105720 2462960 p 2 6 1112965 2466125 1113330 2466125 1113330 2466120 1114175 2466120 1114175 2467120 1112965 2467120 p 3 6 1118210 2453315 1119210 2453315 1119210 2454525 1118215 2454525 1118215 2454170 1118210 2454170
where AAA and BBB are first level keys, and the next are vertexes (x,y) of a polygon

At the end I need to compare the polygons from 2 files.
I thought to use hash to input the first level keys and then every set of polygons will be saved in a B tree structure.
Does any one of you knows a better way of doing that? If so, is there any fit module at the CPAN?

Edited by BazB fixed code tag, tidy/fixed formatting..and added readmore.


In reply to cpan Data structure by michaelg

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.