From: mAyur <[EMAIL PROTECTED]> > By the way, newBee, I have doubt abt ur code is it working? I am just > printing ur code again, with line numbers
Are you trying to be kewl or just can't spell? "abt"? "ur"? > 1: foreach $document(@documents){ > 2: $valueOfTermD = 0; > 3: $powerOfTermD = 0; > 4: foreach $term(keys %termWeightHash){ > 5: if($termWeightHash{$term}{$document}){ > 6: $powerOfTermD = $powerOfTermD + > $termWeightHash{$term}{$document}* > $termWeightHash{$term}{$document}; > 7: } > 8: } > 9: $valueOfTermD = sqrt($powerOfTermD); > 10: $hashTermD{$document} = $valueOfTermD; > 11: > 12: } > > On line 4 u r getting hash reference in $term variable, line 5: u have On line 4 you are getting a hash reference in the $term variable, on line 5 you have ... > a if condition which is checking the $document key of inner hash > (reffered by $term). [Hope i am rt till now?] Hope I am right till now. > so ur condition on line 5 shud be ${$termWeightHash{$term}} so your condition on line 5 should be > {$document} [u have not dereferenced it properly] ... > same mistake is repeated in line 6, what i feel is that ur line 6 shud > look like this ... what I feel is that your line 6 should look like this > > " $powerOfTermD = $powerOfTermD + ${$termWeightHash{$term}} > {$document}* ${$termWeightHash{$term}} > {$document}; " > > > let me know if i am rt. Let me know if I am right. There is no "u", "ur", "shud", "rt" in English! I don't mind typoes, I can understand (and make) stylistic mistakes, I can understand some spelling mistakes (is it "successfull" or "successful"?), but please don't use l33t speak. And by the way you are wrong. First, the $term is a string, a key in the %termWeightHash hash, not a hash reference. and second, ${$termWeightHash{$term}}{$document} is equivalent to $termWeightHash{$term}->{$document} is equivalent to $termWeightHash{$term}{$document} Thanks, Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/