When I'm lost designing code, I generally take a step back. One thing to try is to write the design in pseudocode...
read in each user record (first,last,id) lookup id in a list of id's to determine output file print user record to correct output file end read loop
At this point I don't clutter the design with implementation details, like when do I open or close files. Since the design is not too complex, I'd start to think about how to implement parts of this. Things like "lookup id in a list" bring to mind using hashes since they are designed for fast lookup of single items (see Abigail-IIs example). You could of course use arrays or "if" statements for the "list", and if you have learned other progamming languages before, this might be your first inclination. This is why when learning a new language, I try to examine examples of (good) code written in that language. It just makes understanding this kind of mental association much easier when it comes time to implement code.

In reply to Re: A Love/Hate Relationship - A Long Time Newbie's Current Block by bluto
in thread A Love/Hate Relationship - A Long Time Newbie's Current Block by bivouac

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.