in reply to Quoting words
open(FILE,"+<tabs.txt") or die "Couldn't open tabs.txt: $!"; my @file = <FILE>; seek(FILE,0,0); foreach(@file) { s/\t/,/g; print FILE $_; } close(FILE);
Now for putting quotes around your values:
open(FILE,"+<tabs.txt") or die "Couldn't open tabs.txt: $!"; my @file = <FILE>; seek(FILE,0,0); foreach(@file) { chomp(); my $line = ""; my(@values) = split(/\,/,$_); foreach my $value(@values) { $value = "\"$value\"" if $value !~ /^\".*?\"$/; $line .= "$value,"; } chop($line); print FILE "$line\n"; } close(FILE);
|
|---|