So, I have an array of hashes, @doc\_vector. I want to go through each hash and modify the values of the keys.

The original code that I was working with is as follows:

```
my %hash=undef;

foreach my $hash (@doc_vector) {
      foreach my $key (keys %{ $hash }) {
         $hash{ $key } = log($dnum/$dfreq_hash{$key});
     }
 }

```

But, when I actually referred to the hashes in @doc\_vector, the values were never modified.
I was able to modify a particular value by doing the following (I saved the index of the last hash entry and a key whose value I knew, $last\_doc and $word, respectively): 

```
foreach my $hash (@doc_vector) {
      foreach my $key (keys %{ $hash }) {
            if ($key eq $word)
         {
             $doc_vector[$last_doc]{$word}=log($dnum/$dfreq_hash{$key});                        
         }
       }
     }

```

That worked fine, but when I tried to do this for all of my entries:

```
foreach my $hash (@doc_vector) {
      foreach my $key (keys %{ $hash }) {
         $doc_vector[$hash]{$key}=log($dnum/$dfreq_hash{$key});
     }
     print "I'm going infinite\n";
 }

```

I end up printing "I'm going infinite" over and over again. I have a feeling that the issue is that I'm putting in a hash reference, $hash, instead of an index, but I don't know how to get the index (and the way that I originally tried to do this (1st code segment didn't work). 

Any help would be much appreciated.

Thanks in advance.