my @columns = (qw/what ever the items are for each columns/); $csv = Text::CSV_XS->new(); # $io is a filehandle from IO::File which has a print method. A glob does not. $status = $csv->print($io, \@columns);