perl统计句子每个单词出现次数
1个回答
展开全部
while (my $line = <DATA>)
{
map{$words{$_}++;} $line =~ /(\w+)/g
}
for (keys(%words))
{
print "$_: $words{$_}\n";
}
__DATA__
I am a great man.
There is also a great river run aside of me.
He and me all alike climbing mountains.
He says man are creatures of big thinking.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询