http://www.perlmonks.org?node_id=24125

kfarr has asked for the wisdom of the Perl Monks concerning the following question:

I have a very ugly COBOL record descriptor, and need to parse the record into a semicolon delimted format. For this particular record type, the first two bytes comprise the first field, the next four, etc. etc. I suspect an array would make life easy, as I can assemble the final 'product' with a join command. Any ideas?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: What is the best way to parse a 488 byte record?
by fundflow (Chaplain) on Jul 24, 2000 at 21:27 UTC
    It sounds like all you need is this:
    $out=join(";", unpack("A2A4...", $rec));
Re: What is the best way to parse a 488 byte record?
by lhoward (Vicar) on Jul 24, 2000 at 21:10 UTC