[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Doubt in References and complex datastructures


Michael,
            thanks a lot Michael I figured it out using the Data Dumper..Actually the last attribute wasnt initialised..I changed the code as follows.
for ($i=0;$i<=$#terms;$i++)
{
    $wordlistref->{$terms[$i]}->{"postingsref"}->{"doc"}->{"d1"}->{"termfreq"}++;
}
print $wordlistref->{$terms[0]}->{"postingsref"}->{"doc"}->{"d1"}->{"termfreq"};
'2003' => {
                      'postingsref' => {
                                         'doc' => {
                                                    'd1' => {
                                                              ' ' => 1
                                                            }
                                                  }
                                       }
                    }
 
Corrected one
'2003' => {
                      'postingsref' => {
                                         'doc' => {
                                                    'd1' => {
                                                              'termfreq' => 1
                                                            }
                                                  }
                                       }
                    }
 
On 12/11/06, Michael Peters <suppressed> wrote:


Deepak Mallya wrote:
> Michael,
>              with no variable but just constants inside(I still get the
> same error) I am actually trying to build a complex data structure on
> the fly with dynamic values..what do I need to do?.

What line is the warning coming from? The line where you're doing the increment?
Or the line where you're printing?

If you have doubt as to what your data structure looks like, use Data::Dumper to
peak at it.

> for ($i=0;$i<=$#terms;$i++)
> {
>
> $wordlistref->{$terms[$i]}->{"postingsref"}->{"doc"}->{"d1"}->{$termfreq}++;
> }
> print
> $wordlistref->{$terms[0]}->{"postingsref"}->{"doc"}->{"d1"}->{$termfreq};

print Data::Dumper::Dumper($wordlistref);

--
Michael Peters
Developer
Plus Three, LP



Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.