#!/usr/bin/perl use strict; use warnings; my $filename = 'file.tabs'; local @ARGV = ($filename); local $^I = '.bac'; while (<>){ chomp; $_ = join(',', map {qq{"$_"}} split "\t") . "\n"; print; }