I'd be grateful if somebody could let me know what I'm dong wrong.my $file = "C:\\areopagitica.txt"; open(IN, $file) || die "File not found"; my @thisfile = <IN>; close(IN); chomp @thisfile; my %seen=(); while (@thisfile) { while ( /(\w['\w-]*)/g ) { $seen{lc $1}++; } } foreach my $word (sort { $seen{b} <=> $seen{a} } keys %seen) { printf "%5d %s\n", $seen{$word}, $word; }
In reply to Word Frequency counter by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |