#!/usr/local/bin/perl -w use strict; use warnings; open(FILE, "+; # Read entire file into array map{ s/'/\t/g } @file; # substitution on each element seek(FILE,0,0); # go back to the beginning of the file truncate(FILE, tell(FILE)) # truncate from here to end of file print FILE @file; # write back to file close FILE;