I've been asked to build a master part number interchange table and given a collection of files which each contain a list of part number equivalencies for two of four formats. I need to read all of these and build an output file which combines the information in all of the input files.

The actual files present all contain interchanges from the same catalog (lester) to another number, so the obvious solution for this case is to just build three hashes, one for each of the non-lester formats, and use the lester number as the key and the non-lester number as the associated value. I, however, feel compelled to over-engineer the project and not depend on the lester number's presence.

I'm currently thinking that the most sensible way to handle this would be to simply use an array of strings with 4 delimited fields in each string, one field for each catalog's number. They can then be separated easily enough using split, existing entries can be located on any catalog's number by grepping for a simple regex, a sort routine with the ability to sort them on any particular catalog's numbers could be written fairly easily, etc.

The only thing is, it feels like a pretty clumsy design. Anyone have suggestions of a better/cleaner way to do it?


In reply to 4-way interchange mapping by dsheroh

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.