meili 发表于 2022-10-27 15:51:06

perl统计句子每个单词出现次数

<p>问题:perl统计句子每个单词出现次数
<p>答案:↓↓↓<p class="nav-title mt10" style="border-top:1px solid #ccc;padding-top: 10px;">洪荣晶的回答:<div class="content-b">网友采纳  while (my $line = <DATA>)  {  x09map{$words{$_}++;} $line =~ /(w+)/g  }  for (keys(%words))  {  x09print "$_: $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.
页: [1]
查看完整版本: perl统计句子每个单词出现次数