SamCG has asked for the wisdom of the Perl Monks concerning the following question:
The relevant data looks similar to:if (/GAA\d{8}4VD\d{6}/i){ ($jnk,$acctid,$cusip,$jnk2,$symbol,$jnk3,$trantype,$buysell,$jnk4,$tra +dedate,$settledate,$timeformat,$src,$pershingref,$batchcode,$oppacct, +$mktcode,$blottercode,$cancelcode,$corrcode,$mktlimit,$jnk5,$quantity +,$qsign,$price,$jnk6,$prcsign,$pricecurrency, $netamt, $principal,$in +terest, $comm) = unpack ($_, "A11A10A9A17A16A6A1A1A18A8A8A7A2A6A6A10A1A1A1A1A1A4A18A1A1 +8A5A1A3A19A19A19A19");
I was under the impression I only need to define the template up to the point where I want data. I get an "Invalid type in unpack: 'G'" error. I get this even if I limit my unpacking to the first field, i.e.,GAA000000144VD0000011G76893111 G76893111 RBSPF 000 T +S 03002004071320040713200407160154628 #45678*GLOS 4VD000001145 + 000000001000000000-000000015610000000 +USD00000000020000140 +0-000000000200001400-000000000000000000 000000000000000000 0000000000 +00000000 000000000000000000 000000000000000000 000000000000000000 000 +000000000000000 000000000000000000 000000000000000000 000000000000000 +000 000000000000000000 000000000000000000 000000000000000000 00000000 +00000000000 000000000000000000000000000000000000 000000000000000000 + 10 000000000000000000 0000 +00023640000000+ + X
I've seen this error referenced in a similar fashion in various places on the internet (usually with type 'Q'), but I haven't seen an indication of the solution.if(/GAA\d{8}4VD\d{6}/i){ ($jnk) = unpack ($_, "a11");}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Invalid Type -- Unpack
by davido (Cardinal) on Sep 01, 2004 at 18:51 UTC | |
by SamCG (Hermit) on Sep 01, 2004 at 19:03 UTC |