First, I would add a
use warnings; statement
after
use strict;. I suspect that some run time errors will surface with this code.
This code is written with column based parsing of the input line(s).
That is what unpack ("a1 a9 a8 a16 a14 a40 a40 a40 a40 a40 a40 a40 a40 a4... is about.
One character, 9 characters, 8 characters, 16 characters,...etc.
"C123456789abcedfghi" parses to "c", "123456789", "abcedfghi".
"C 89 hi" parses to "C", "89", "hi".
There are a number of reasons why this is a bad format. But it is what it is.
To add a column, you need to add an "a3" (3 characters, or whatever number) into the unpack and pack statements.
Then add a variable in the assignment statement in the appropriate order.
There are of course quite a number of improvements that could be made. However, to just add a column that is what you need to do.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.