如何替换用双引号引起来的值
How to substitute values enclosed in double quotes
我需要替换用双引号引起来的值。目标是用问号代替逗号,用连字符代替双引号包围的双引号。
use Text::ParseWords;
my $dlm = ","; # 区切り文字を定義
open(RH, "<", "from.csv");
open(WH, ">", "to.csv");
while(<RH>){
chomp;
my @parsed = parse_line($dlm, 1, $_);
for(my $i=0; $i<=$#parsed; $i++){
$parsed[$i] =~ s/$dlm//g;
}
print WH join($dlm, @parsed)."\n";
}
close(WH);
close(RH);
我需要替换用双引号引起来的值。目标是用问号代替逗号,用连字符代替双引号包围的双引号。
use Text::ParseWords;
my $dlm = ","; # 区切り文字を定義
open(RH, "<", "from.csv");
open(WH, ">", "to.csv");
while(<RH>){
chomp;
my @parsed = parse_line($dlm, 1, $_);
for(my $i=0; $i<=$#parsed; $i++){
$parsed[$i] =~ s/$dlm//g;
}
print WH join($dlm, @parsed)."\n";
}
close(WH);
close(RH);