in reply to Seperating Fixed Line Feed into Fields

I would use unpack to unpack the fields into an array - which can be done in a single command instead of the 82 substrings. Then I'd use one of the CPAN modules that knows excel to write out the file.

Replies are listed 'Best First'.
Re^2: Seperating Fixed Line Feed into Fields
by drodinthe559 (Monk) on Jun 10, 2009 at 20:29 UTC
    How would that unpack command look? Below is what I have so far.
    push @array, unpack("A34", $string);
      my @fields = unpack('A34 A30 A40 ...', $string);
      or
      my @field_sizes = (34, 40, 40, ...); my $rec_format = join '', map "A$_", @field_sizes; my @fields = unpack($rec_format, $string);

      Then use $fields[0] instead of $FIELD01, $fields[1] instead of $FIELD02, etc.