"perl -e ' $sep=","; while(<>) { s/\Q$sep\E/\t/g; print $_; } warn "Changed $sep to tab on $. lines\n" ' csvfile.csv > tabfile.tab" #### #!/usr/bin/perl use strict; use warnings; my $sep=","; open (my $csv_file , "<" , 'csvfile.csv'); open (my $tab_file , ">" , 'tabfile.tab'); while(<$csv_file>) { s/\Q$sep\E/\t/g; print $tab_file, $_; } warn "Changed $sep to tab on $. lines\n" #### "Monster, The Cookie", "123 Sesame St, TV land"