- 论坛徽章:
- 6
|
本帖最后由 stanley_tam 于 2016-08-19 10:58 编辑
 - #!/usr/bin/perl -w
- use strict;
- open (IN, "<", "A.txt") or die $!;
- open (OUT,">", "B.txt") or die $!;
- # my @A;
- # my @B;
- my %hash = (
- 'f^ce,i' => 'aa',
- 'E,WE' => 'bb',
- );
- while (<IN>) {
- chomp;
- my @A = split("\t", $_);
- if (exists $hash{$A[1]}) {
- $A[1] = $hash{$A[1]};
- print OUT "@A$/";
- }
- # @B = @A;
- # my $m = $A[1];
- # if ($m eq "f^ce,i"){
- # $m = "aa";
- # $B[1] = $m;
- # }elsif($m eq "E,WE"){
- # $m = "bb"
- # $B[1] = $m;
- # }
- # print OUT @B;
- }
- close IN;
- close OUT;
复制代码 |
|