【发布时间】:2021-02-01 04:32:54
【问题描述】:
我有一个 XML 文件。我需要将comment="18" 中的数字替换为comment="my string",其中我的字符串来自我的@array($array[18] = my string)。
<rule ccType="inst" comment="18" domain="icc" entityName="thens" entityType="toggle" excTime="1605163966" name="exclude" reviewer="hpanjali" user="1" vscope="default"></rule>
这是我尝试过的。
while (my $line = <FH>) {
chomp $line;
$line =~ s/comment="(\d+)"/comment="$values[$1]"/ig;
#print "$line \n";
print FH1 $line, "\n";
}
【问题讨论】:
-
你试过什么?你有什么问题?请向我们展示您的代码。