sub weights { my ( $self ) = @_; # Step through each stemmed term indexed foreach my $stem ( keys %{$self->{'_index_count'}} ) { # Step through each document in which the stemmed term $stem appears, # calculate its weight and store this ranking in the %weights hash. my %weights; foreach my $url ( keys %{${$self->{'_index_frequency'}}{$stem}} ) { $weights{$url} = sprintf "%.2f", ${${$self->{'_index_frequency'}}{$stem}}{$url} * log( ( scalar keys %{$self->{'_crawl_visited'}} ) / $self->{'_index_count'}->{$stem} ); } # Store ranking score in tied hash - Note the fashion by which the hash # reference is built first and then assigned to the MLDBM-tied hash. This is # required due to the limitations of the Perl TIEHASH interface which has no # support for multi-dimensional ties. ${$self->{'_tied_weight'}}{$stem} = \%weights; } }