maida has asked for the wisdom of the Perl Monks concerning the following question:
Thanks in advance. -Shawn__DATA__ AP040003EZ9891783 61125 N BX 108.0 0000 03196 + 00000 D Y B BP041303DD554 009J0 N BX 8.7 5000 03168 +62 00000 Y W ___PART OF THE CODE________ elsif (/^\s+?\S{13}\s+?\S+?\s+?\S/){ $_ =~ s/^\s*//; my @fields = unpack "a21 a9 a9 a2 a13 a8 a9 a9 a4 a5 a6", $_; print " PIIN \= $fields[0]\n"; print " FSCM \= $fields[1]\n"; print " N/A \= $fields[2]\n"; print " U/I \= $fields[3]\n"; print " UNIT PRICE \= $fields[4]\n"; print " AWD DT \= $fields[5]\n"; print " QTY \= $fields[6]\n"; print " OPT DT \= $fields[7]\n"; print " FOB \= $fields[8]\n"; print " REP \= $fields[9]\n"; print " TYPE \= $fields[10]\n"; print "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A more elegant use of unpack
by wfsp (Abbot) on Sep 03, 2004 at 12:20 UTC | |
|
Re: A more elegant use of unpack
by clscott (Friar) on Sep 03, 2004 at 16:42 UTC | |
by mifflin (Curate) on Sep 03, 2004 at 18:32 UTC | |
|
Re: A more elegant use of unpack
by Aristotle (Chancellor) on Sep 03, 2004 at 16:29 UTC |