in reply to Re^2: file parsing help
in thread file parsing help
Take a look at the docs for unpack (also pack as it carries more information).
Briefly, the format template 'xa5x2a3x2a15x2a6x2a5x2a5x4a5x9a8x4a9x5a5x15a5x4a9', consists of 2 types of format specifier.
Used here to skip over the inter-column whitespace.
This is used to extract the fixed format fields.
The results are assigned into the array @temp. Note that the length specifiers I've used are quickly approximated from the example posted, you will want to review the values carefully in the light of your full data.
Unlike a regex capture, what is in the bytes captured is irrelevant, it is based entirely upon the character positions (like substr). I've attempted to show how the parsing works below, but the stupid wrap 'feature' of PM means it doesn't really work.
< 0> <1> < 2 > < 3 > < 4 > < 5 > < 6 > xaaaaaxxaaaxxaaaaaaaaaaaaaaaxxaaaaaaxxaaaaaxxaaaaaxxxxaaaaaxxxxxxxxx 0 CDE, DEBORAH M. AAF103 FJB1A FTB5A 3.0 < 7 > < 8 > < 9 > <10 > < 11 > aaaaaaaaxxxxaaaaaaaaaxxxxxaaaaaxxxxxxxxxxxxxxxaaaaaxxxxaaaaaaaaa .02 107.83 3.0 .02 107.83
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: file parsing help
by ctaustin (Sexton) on Nov 13, 2006 at 22:32 UTC |