in reply to Splitting file into separate files based on record lengths and identifiers

You could do it using unpack, but it leaves it up to you to group back into pairs.
$ perl -E'say for unpack "(x4 A X5 A4x/A)*", $ARGV[0]' \ '0004$ADAM0002*330004%19770004$BOB 0002*430004%1967' $ ADAM * 33 % 1977 $ BOB * 43 % 1967
  • Comment on Re: Splitting file into separate files based on record lengths and identifiers
  • Download Code

Replies are listed 'Best First'.
Re^2: Splitting file into separate files based on record lengths and identifiers
by choroba (Cardinal) on Aug 30, 2010 at 16:04 UTC
    Shouldn't it be /a instead of /A to include the space after BOB?
      Probably. "A" will trim trailing spaces. "a" won't. User's choice.