10 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13
open (INFILE, "Reuters_Topnews.txt"); while(<INFILE>) { chop;   ; tr/A-Z/a-z/; # convert to lower case tr/.,:-;!?"(){}//d; # strip out punctuation foreach $word (split) { # split line into words $count{$word}++; # count words, put count into hash (word is key, count is value) } } foreach $word (sort keys %count) { # sort hash by the value of the key print "$word $count{$word}\n"; # print out the hash in key order }
1
2
3
4
5
6
foreach my $sign (keys %charcount) {
# Hier Dein code:
# Zugriff auf die einzelnen counter mit:
my $cnt = $charcount{$sign};
.....
}
$ln = log($x)/log(2)
10 Einträge, 1 Seite |