in reply to parsing CSV file with embedded commas (fortunately, fixed-width) - is unpack the solution?

Something close to

@fields= unpack "xA8x3A5x3A8x3A37x3A1x3A1x2A2x2A1x3A2x3A2x2A6x1" . "A10x1A10x2A1x3A16", $record;
should work.

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re: parsing CSV file with embedded commas (fortunately, fixed-width) - is unpack the solution?
  • Download Code

Replies are listed 'Best First'.
Re: (tye)Re: parsing CSV file with embedded commas (fortunately, fixed-width) - is unpack the solution?
by amelinda (Friar) on Oct 31, 2001 at 22:56 UTC
    That makes some sense... A seems to be for text (ascii?)... though I'm not sure what the difference tween A and a is. But what're the x's for? Single chars? Punctuation? !text?

      "a$n" pulls out the next $n characters of text as a string. "A$n" does the same thing but strips spaces and "\0"s from the end. "x$n" skips $n bytes.

              - tye (but my friends call me "Tye")