in reply to agregating columns in several csv files

Your problem seems to be solved by now, but some issues come to my mind:

1) The length of command lines (@ARGV) is most likely limited to about 512 chars and would not contain 3k of file names. I'd check if totals.csv matches the output of the calling program.

2) Concatenating all files before agregating makes your problem go away.

3) Buffering @ARGV into total.csv is not required.

4) Move opening and closing files into the outer loop. This way you have just one file open at a time. This is the standard approach.

5) Depending on the size of files, available RAM and your performance requirements, it might make sense to 'slurp' input files into memory in one go (or one by one). Your agregation then works on a 2D array.

  • Comment on Re: agregating columns in several csv files