On 08/06/2011 16:30, Jon Forsyth wrote:
Hello Perl community,
Hey Jon
I am trying to get a simple program working that will count the words in a
text file and put them in a hash with the key being the word and the value
being its frequency in the text file. Here is my code:
---
#!/usr/bin/
On Wed, Jun 8, 2011 at 11:30, Jon Forsyth wrote:
This part:
> foreach (%word_count){
> print "$word_count{$_}\n\n";
> }
You want to write like this:
foreach my $key ( keys %word_count ) {
print "$word_count{$key}\n\n";
}
What you've got above is getting both keys *and* values from the hash
Hello Perl community,
I am trying to get a simple program working that will count the words in a
text file and put them in a hash with the key being the word and the value
being its frequency in the text file. Here is my code:
---
#!/usr/bin/perl
use strict;
use warnings;
{
open IN, ";
forea