Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Word Frequency counter
by GrandFather (Saint) on Oct 02, 2008 at 20:30 UTC | |
by Anonymous Monk on Oct 03, 2008 at 07:53 UTC | |
|
Re: Word Frequency counter
by Fletch (Bishop) on Oct 02, 2008 at 20:16 UTC | |
|
Re: Word Frequency counter
by toolic (Bishop) on Oct 02, 2008 at 20:23 UTC | |
by DrWhy (Chaplain) on Oct 02, 2008 at 20:32 UTC | |
|
Re: Word Frequency counter
by apl (Monsignor) on Oct 02, 2008 at 20:34 UTC | |
|
Re: Word Frequency counter
by planetscape (Chancellor) on Oct 03, 2008 at 12:10 UTC | |
|
Re: Word Frequency counter
by Lawliet (Curate) on Oct 02, 2008 at 20:21 UTC |