I am a super novice Perl programmer.

I have 2 delimited files. File 1 is pipe delimited and contains names with social security numbers. File 2 is comma delimited and contains names, socials and a unique identifier that is alphanumeric. There is a max of 1 row of data for each person in file 2. There could be none. The is 1 or more rows of data for each person in file 1. Could be 1 or there may be 30. And the rows are typically interspersed throughout the file (not together). What I need to do is grab the SSN from file 1, find that SSN in file 2, grab the corresponding unique identifier from file 2 and plug it into a field in the record in file 1. I have a Perl script that is working but it is very, very slow. I am splitting the file 1 lines into an array, doing the lookups and replaces and then writing the line to a file. I repeat this until I process all the records in file 1.

Sorry to be so long winded. Any suggestions on how to improve (speed up) would be greatly appreciated.

I would be happy to post my code but it is probably too long for this small box.


In reply to Best way to search file by insta.gator

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.