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
(I assumed here that instead of NO NAME any arbitrary string could be in that place)($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;
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.
In reply to Re^3: Parser help
by jethro
in thread Parser help
by MKevin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |