in reply to Re: Urgent Help: Array of Hashes
in thread Urgent Help: Array of Hashes

Hi, I am building a small search utility, and the D's in the array are documents. The values are frequency of words in each document. The final array, just contains a summary of documents and the total occurences Rgds

Replies are listed 'Best First'.
Re^3: Urgent Help: Array of Hashes
by perlfan (Parson) on Sep 27, 2007 at 15:10 UTC
    You can conveniently store the counts of particular "words" using a hash:
    #!/usr/bin/env perl use strict; use warnings; my %freqs = (); # .... # for each match of $word $freqs{$word}++; # ... # the list the counts: foreach my $word (keys(%freqs)) { print "$word: $freqs{$word}\n"; } 1;