in reply to Re^2: split large CSV file >9.1MB into files of equal size that can be opened in excel
in thread split large CSV file >9.1MB into files of equal size that can be opened in excel

I think that's why the OP ran $chunk = <FH>; after the read(FH, $chunk, 10000); block: it reads whatever is left on the current line (or, if the read happened to end at the end of a line, it will read one extra line) and includes that extra bit in the same file. (This of course still assumes that there are no newlines supposedly protected by quotes in the source CSV, but with a name like "all_tags2", I am guessing that there aren't newlines in "tags".)

  • Comment on Re^3: split large CSV file >9.1MB into files of equal size that can be opened in excel
  • Select or Download Code