问题:
在包含的文件中查找文本片段@
并替换内部
输入:
@abc@ abc @ABC@
cba @cba CBA@
期望的输出:
абц abc АБЦ
cba цба ЦБА
我有以下内容:
#!/usr/bin/perl
use strict;
use warnings;
use Encode;
my $output;
open FILE,"<", 'test.txt';
while (<FILE>) {
chomp(my @chars = split(//, $_));
for (@chars) {
my @char;
$_ =~ s/a/chr(0x430)/eg;
$_ =~ s/b/chr(0x431)/eg;
$_ =~ s/c/chr(0x446)/eg;
$_ =~ s/d/chr(0x434)/eg;
$_ =~ s/e/chr(0x435)/eg;
$_ =~ s/A/chr(0x410)/eg;
$_ =~ s/B/chr(0x411)/eg;
$_ =~ s/C/chr(0x426)/eg;
push @char, $_;
$output = join "", @char;
print encode("utf-8",$output);}
print "\n";
}
close FILE;
但我坚持如何进一步处理
提前感谢您的帮助!
克鲁瑟