该文件包含多行,如下所示
TT AA TT GG CC AA
AA GG CC TT GG CC
GG AA TT TT CC TT
答案 0 :(得分:1)
这样的事可能吗?
#!/usr/bin/env perl;
use strict;
use warnings;
while ( <DATA> ) {
chomp;
my %count_of;
$count_of{$_}++ for split;
print "Row $.:\n";
foreach my $key ( sort {$count_of{$b} <=> $count_of{$a} } keys %count_of ) {
print "\t$key: $count_of{$key}\n";
}
}
__DATA__
TT AA TT GG CC AA
AA GG CC TT GG CC
GG AA TT TT CC TT