in reply to Converting a text file to a csv file

I think you need to split each line into an array and pass the array reference to print into the out file.
my $csv = Text::CSV->new ({ binary => 1, eol => "\n" }); open(my $out,">>",$outfile); open (CSV, "<", $file) or die $!; while(<CSV>) { my @array=split /\s+/; $csv->print($out,\@array); }

Replies are listed 'Best First'.
Re^2: Converting a text file to a csv file
by $new_guy (Acolyte) on Sep 28, 2010 at 10:26 UTC
    Hi Suhailck,

    It works perfectly! Thanks!!