in reply to Re^2: Parser help
in thread Parser help

unpack is for parsing binary files. For example the 'x' in your $format doesn't parse a space but a real byte 0x00 nowhere to be found in your example data. I don't say it is not possible to use unpack to parse text files, but it is like using a soldering iron to repair your wrist watch.

You seem to have some other misconceptions about unpack. Your line 40 makes no sense. The assignment of ($1,$3,$5,$7... to the variables will not influence the assignement from unpack later to only pick the first, third and so on of the parsed items

Use regexes instead. For example your title line can be parsed by

($CardNo, $MMDD, $YY, $StormNo, $TotalNo, $Name, $XING, $SSS)= m{^(\d+)\s+ (\d\d/\d\d) /(\d+)\s+ #the date M=(\d+)\s+ (\d+)\s+ SNBR=\s*(\d+)\s+ (.+) \s* # arbitrary name or NO NAME XING=(\d+)\s+ SSS=(d+) \s* $}x;
(I assumed here that instead of NO NAME any arbitrary string could be in that place)

Note that I use \s+ to parse a space. That makes the parsing more robust, because it doesn't matter if there is a tab character instead of a space or more than one space. Also I use \s* in places where spaces are optional

m{} is the same as //, it is just nicer if you have a '/' to parse, you don't need to escape it. The x lets me use spaces and comments in the regex

I kept the regex simple, you should be able to construct the regex for the other lines from this. Just read some more about regexes in a good perl book or online documentation.