程嶏清单4-1.txt

来自「< linux网络编程工具>>配套源码」· 文本 代码 · 共 25 行

TXT
25
字号
# This program finds the Capitalized words
while ($inputline = <STDIN>) {
   while ($inputline =~ /\b[A-Z]\S+/g) {
       $word = $&;
       $word =~ s/[;.,:-]$//;        #   remove punctuation
       for ($count = 1; $count <= @wordlist; $count++) {
           $found = 0;
           if ($wordlist[$count-1] eq $word) {
               $found = 1;
              $wordcount[$count-1] += 1;
             last;
          }
      }
      if ($found == 0) {
          $oldlength = @wordlist;
        $wordlist[$oldlength] = $word;
        $wordcount[$oldlength] = 1;
     }
  }
}
print ("Capitalized words and number of occurrences:\n");
for ($count = 1; $count <= @wordlist; $count++) {
   print ("$wordlist[$count-1]: $wordcount[$count-1]\n");
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?