in reply to Urgent Help: Array of Hashes

It's odd that you used the word "associative array". Where did you get that from? That term has been disfavored for over a decade.

Also, I smell homework.

Replies are listed 'Best First'.
Re^2: Urgent Help: Array of Hashes
by mirage_zz (Novice) on Sep 26, 2007 at 23:47 UTC
    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
      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;