in reply to Combing Text Files into one file
The only error I can see is that
print "@data\n"; should have been print OUTF "@data\n";The coding is actually good, btw - not very idiomatic, so a bit awkward, but you obviously understand what's going on behind the scenes. Nice effort.
The only thing I can see here is I wouldn't open combine.csv every time through the loop anew, and wouldn't slurp the input file into an array.
open(OUTF,">>combine.csv") or dienice("Can't open CSV file: $!"); foreach my $file ( @files ) { open(INF,"$file") or dienice("Can't open data file: $!"); print OUTF while <INF>; close(OUTF); } close(INF);
Update: nevermind, the above proposals are better.. duh. :-)
Makeshifts last the longest.
|
|---|