use Text::CSV; my $csv = Text::CSV->new ({ binary => 1, auto_diag => 1, # Have the module complain about errors allow_whitespace => 1, # allow 1 , 2 ,3 }); my $in_file = "C:/Documents and Settings/x0199665/My Documents/temporary.tl"; open my $in_fh, "<", $in_file or die "could not open $in_file: $!\n"; my @rows; # Use Text::CSV (or Text::CSV_XS) to parse, not split while (my $row = $csv->getline ($in_fh) { push @rows, $row; } close $in_fh or die "could not close $in_file: $!\n"; # my $rows = $csv->getline_all ($in_fh); # would do all in one go print " Please enter the name of your csv file in which you will make modifications: "; chomp (my $out_file = ); open my $out_fh, ">", $out_file or die "could not open $out_file: $!\n"; $csv->eol ("\n"); $csv->print ($out_fh, $_) for @rows; close $out_fh or die "could not close $out_file: $!\n";