|
1 : #!/usr/local/bin/perl
2 :
3 : while ($inputline = ) {
4 : while ($inputline =~ /b[A-Z]S+/g) {
5 : $word = $&;
6 : $word =~ s/[;.,:-]$//; # remove punctuation
7 : $wordlist{$word} += 1;
8 : }
9 : }
10: print ("Capitalized words and number of occurrences:n");
11: foreach $capword (keys(%wordlist)) {
12: print ("$capword: $wordlist{$capword}n");
13: }
第5句话是什么意思?wordlist如何出来的? |
|