没有提取的数据输出到 data2.txt?代码出了什么问题?
我的文件.txt
ex1,fx2,xx1
mm1,nn2,gg3
EX1,hh2,ff7
这是我在 data2.txt 中想要的输出:
ex1,fx2,xx1
EX1,hh2,ff7
#! /DATA/PLUG/pvelasco/Softwares/PERLINUX/bin/perl -w
my $infile ='My1.txt';
my $outfile ='data2.txt';
open IN, '<', $infile or die "Cant open $infile:$!";
open OUT, '>', $outfile or die "Cant open $outfile:$!";
while (<IN>) {
if (m/EX$HF|ex$HF/) {
print OUT $_, "\n";
print $_;
}
}
close IN;
close OUT;