use strict; use warnings; use Text::CSV; my ($file, output) = ("112008.csv", "112008.txt"); my $csv = Text::CSV->new ({ binary => 1 }); open my $ih, "<", $file or die "Can't open in file $file: $!"; open my $oh, ">", $output or die "Can't open out file $output: $!"; while (my $row = $csv->getline ($ih)) { my @columns = map { sprintf "%.3f", $_ } @$row; # do something with @columns print { $oh } join "|", @columns, "\n"; } $csv->eof () or $csv->error_diag (); close $ih or die "$file: $!"; close $oh or die "$output: $!";