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;