bit-question
bit-question

Reputation: 3843

How to analyze this hash of hash example?

For the following code snippet, is my understanding of $label = $classifier->{result}->{forcast}->[$i]->{label}; correct?

1) result is used as the key for hash ref of classifier;

2) forcast is used as the key for hash ref of $classifier->{result}

3) $classifier->{result}->{forcast} is a ref to an array, and i-th value of this array is also a hash reference

4) The label is the key of the hash reference $classifier->{result}->{forcast}->[$i]. The corresponding value is assigned to the left side of $label.

my $i=0;
while (<classifierinput>)
{
   $label = $classifier->{result}->{forcast}->[$i]->{label};
   $i++;
}

Upvotes: 5

Views: 220

Answers (1)

tadmc
tadmc

Reputation: 3744

Yes, your understanding is correct.

Upvotes: 2

Related Questions