Why aren't you using Text::CSV_XS for output too?
#!/usr/bin/perl -w
use strict;
use Text::CSV_XS qw( );
my $qfn_in = 'data.txt';
open(my $fh_in, '<', $qfn_in)
or die("Can't open file \"$qfn_in\": $!\n");
my $fh_out = \*STDOUT;
my $csv_in = Text::CSV_XS->new({ sep_char => ',', eol => $/ });
my $csv_out = Text::CSV_XS->new({ sep_char => "\t", eol => $/ });
my $number = 10;
while ( my $row = $csv_in->getline($fh_in) ) {
$csv_out->print($fh_out, [
"Olah:",
$number++,
@$row[2,5,3,0,4],
]);
}
Mind you, the output format is slightly different than yours. (It will quote all fields or only necessary fields depending on option always_quote).
It could use error checking, but you didn't have any either.