in reply to Re^5: Parse one fiile, send the records to two different files
in thread Parse one file, send the records to two different files

So close - all the commas are now back in, but it's still putting all the fields in as one big long sole record.
  • Comment on Re^6: Parse one fiile, send the records to two different files

Replies are listed 'Best First'.
Re^7: Parse one fiile, send the records to two different files
by poj (Abbot) on May 27, 2016 at 19:00 UTC

    Why not just print the original line with the new line ending you chomped replaced ?

    print $ERR_FH $line."\n";
    poj

      ...or just do this :)

      Thank you! That's got it!
Re^7: Parse one fiile, send the records to two different files
by stevieb (Canon) on May 27, 2016 at 18:58 UTC

    If I understand you correctly, you're getting a single line now, yes? Try adding a newline to the joined string:

    if (!length $fields[28]) { chomp @fields; my $str = join ',', @fields; print $ERR_FH "$str\n"; }