|
发表于 2002-11-5 13:53:58
|
显示全部楼层
#!/usr/bin/perl
my $file= "./love.txt";
my $filemm= "./lovemm.txt";
open (IN,"$file");
open (OUT,">$filemm");
while (<IN>) {
my $line = $_;
print OUT $line;
chomp($line);
if ($line =~/I love perl/) {
print OUT "I love MM\n";
}
}
close OUT;
close IN; |
|