Thanks to everyone who gave me ideas on Input Formats, unfortunately this report isn't a datafile so I couldn't figure out how the Text Modules since they look for quoted strings and there are none in the print file. I still have a problem though. I can't seem to parse out the data from this print file it's setup like:
<CODE>
Name ID PS Gender Age Month Code Cap Pool
LName, FName 99999 99 M 99.9 12/2000 Add 99.99 99.99
11/2000 New 99.99 99.99
The second line is a second record and sometimes there is no code at all. I wrote this snippet of code to find these data lines:
<CODE>
If ($line =~ /^(\w
A-Z0-9)+/ && length($line) >= 112) {
# parse line
}
elseif ($line =~ /^\s{60}
A-Z0-9/ && substr($line,60,3) ne "Inf") {
# parse line
}
But since there doesn't have to be another code there could be 9 more spaces. Right now I parse it like a fixed length string but I can't seem to get rid of trailing spaces for each field. Is there a simpler way?
Please let me know and thanks,
Jake
PS: I've not written HTML but there are braces (not curly) around the A-Z0-9 but for some reason they don't show up and it creates a link??? Also, 11/2000 should show up underneath 12/2000 for the second line.
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.