Given that you're dealing with 7KB records, I'm guessing that there are quite a few fields packed in there. I would probably use Parse-FixedLength for the job, but then, I'm biased, since I (re)wrote the module :-) And, to be balanced, there are alternatives mentioned in the docs (and in future updates I may also mention Parse-Binary and Parse-Binary-Iterative), and I do confess mention that this and other similar modules are just glorified substitutes for the perl built-in functions pack and unpack.

Update: Since you want to flag the last record for each patient/record-type (if I read that correctly), you will have to decide whether you want to keep records in memory (if there aren't too many records or distinct patient/record-types), or load the data into a database (even a lightweight database like DB_File or DBD::SQLite might be appropriate) and sort by patient/record-type/record-number(desc) to easily "flag" each "last" record. But know that (as already mentioned) perl is perfect for the job, and it would be best if you would start writing sample code and ask for help with specific problem areas (rather than me guessing at what you might have problems with, and which approach to take :-).


In reply to Re: New to PERL - file format conversions to do by runrig
in thread New to PERL - file format conversions to do by Mikhailoh

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.