in reply to How to create an accurate CSV file
or use an existing module such as Text::CSV set sep_char to tab and let the module do the heavy lifting. This has several advantages over rolling your own in most instances, but given the data-set you should get away with the above capture style in this instance.open (INPUT, "<", "input.txt"); while (<INPUT>){ chomp(my $record = $_); print join ",", (split /\t/, $record); }
|
|---|