BED001 |137CM BUDGET BLUE B/SET |BED001 |BASE & MATTRESS | |Ea |0 |0 |39.47 |0.00
BED0015 |183CM BODY CUSHION BASE SET |BED0015 |BASE & MATTRESS | |Ea |0 |0 |1,099.91 |0.00
####
BED001,137CM BUDGET BLUE B/SET,BED001,BASE & MATTRESS,,Ea,0,0,39.47,0.00
BED0015,183CM BODY CUSHION BASE SET,BED0015,BASE & MATTRESS,,Ea,0,0,"1,099.91",0.00
####
use strict;
use Text::CSV;
my $csv = Text::CSV->new( { sep_char => "|", allow_whitespace => 1 } );
my $infile = "s.txt";
my $outfile = "s.csv";
open( my $fh, "<", $infile );
open( my $out, ">", $outfile );
while ( my $array = $csv->getline($fh) ) {
local $" = ",";
local $\ = "\n";
#$csv->combine(@{$array});
#my $line=$csv->string();
print $out "@{$array}";
#print $out $line;
}
####
BED001,137CM BUDGET BLUE B/SET,BED001,BASE & MATTRESS,,Ea,0,0,39.47,0.00
BED0015,183CM BODY CUSHION BASE SET,BED0015,BASE & MATTRESS,,Ea,0,0,1,099.91,0.00