Thanks! I'll leave the message below in case anyone else runs into the same issue.my $lineterm = "\015" my $csvout = Text::CSV_XS->new({eol => $lineterm})
Hello all, I'm having a problem with Text::CSV_XS and the output resulting from i +ts print() function. I have the following code: for my $i (0..$#values) { my $fh = new IO::File($master_fn, O_RDWR|O_CREAT|O_APPEND); #DEBUG : for my $j (0..$#{$values[$i]}) { print $debug "value[ +".$i."][".$j."] = ".$values[$i][$j]."\n"; } my $status = $csvout->print($fh, $values[$i]); close $fh; } The problem I'm having is that the output file contains all the entrie +s in a single row. I have tried creating the array in various ways b +ut I believe this may be the nature of the CSV_XS module. The debug +statement above prints out similar to the following: value[0][0] = value[0][1] = 2009/03/26 value[0][2] = 16:28:21 value[0][3] = 8 value[0][4] = This is some sample text. value[1][0] = value[1][1] = 2009/03/29 value[1][2] = 10:27:24 value[1][3] = 12 value[1][4] = This is more sample text. value[2][0] = Assigned value[2][1] = 2009/03/26 value[2][2] = 08:58:20 value[2][3] = 3 . . . The print() function requires an array reference as the second argumen +t. I verified the output is correct in the output .csv, but it is si +mply all in one row. If this is the nature of the module, is there a + way I can get around this? As you can see, I have tried opening and closing the file within the l +oop, but I have also tried opening the file outside the loop. Both h +ave resulted in the same output. I've also tried to append a \n to t +he last value, but no luck. I've exhausted my options and appreciate any help you can provide. Thanks!
In reply to Text::CSV_XS->print output by mcarthey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |