elsif ( $att =~ m/!!ARRAY!!/ ) { # Updated to allow us to get data from an Array -
&Debug("get_value_from_hash:: parsing the ARRAY attribute - $att");
my ( $key1, $key2, $key3, $key4, $key5, $key6 ) = split( /\./, $att );
#&Debug("get_value_from_hash:: key1=$key1, key2=$key2, key3=$key3, key4=$key4, key5=$key5");
if ( defined $key6 ) {
if ( $key5 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1}->{$key2}->{$key3}->{$key4} } ) { $value = $item->{$key6}; }
}
elsif ( $key4 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1}->{$key2}->{$key3} } ) { $value = $item->{$key5}->{$key6}; }
}
elsif ( $key3 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1}->{$key2} } ) { $value = $item->{$key4}->{$key5}->{$key6}; }
}
elsif ( $key2 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1} } ) { $value = $item->{$key3}->{$key4}->{$key5}->{$key6}; }
}
elsif ( $key1 =~ m/!!ARRAY!!/ ) {
for my $item ( @{$hash} ) { $value = $item->{$key2}->{$key3}->{$key4}->{$key5}->{$key6}; }
}
}
elsif ( defined $key5 ) {
if ( $key4 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1}->{$key2}->{$key3} } ) { $value = $item->{$key5}; }
}
elsif ( $key3 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1}->{$key2} } ) { $value = $item->{$key4}->{$key5}; }
}
elsif ( $key2 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1} } ) { $value = $item->{$key3}->{$key4}->{$key5}; }
}
elsif ( $key1 =~ m/!!ARRAY!!/ ) {
for my $item ( @{$hash} ) { $value = $item->{$key1}->{$key3}->{$key4}->{$key5}; }
}
}
elsif ( defined $key4 ) {
if ( $key3 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1}->{$key2} } ) { $value = $item->{$key4}; }
}
elsif ( $key2 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1} } ) { $value = $item->{$key3}->{$key4}; }
}
elsif ( $key1 =~ m/!!ARRAY!!/ ) {
for my $item ( @{$hash} ) { $value = $item->{$key1}->{$key3}->{$key4}; }
}
}
elsif ( defined $key3 ) {
if ( $key2 =~ m/!!ARRAY!!/ ) {
for my $item ( @{ $hash->{$key1} } ) { $value = $item->{$key3}; }
}
elsif ( $key1 =~ m/!!ARRAY!!/ ) {
for my $item ( @{$hash} ) { $value = $item->{$key3}; }
}
}
elsif ( defined $key2 ) {
if ( $key1 =~ m/!!ARRAY!!/ ) {
for my $item ( @{$hash} ) { $value = $item->{$key2}; }
}
}
}
elsif ( $att =~ m/!!HITS\[\d+\]!!/ ) {
&Debug("get_value_from_hash:: parsing the HITS attribute - $att");
my $id = $att;
$id =~ s/!!HITS\[(\d+)\]!!.*/$1/;
$att =~ s/!!HITS\[\d+\]!!\.//;
&Debug("get_value_from_hash:: parsing the attribute - $att");
my ( $key1, $key2, $key3, $key4, $key5, $key6 ) = split( /\./, $att );
#&Debug("get_value_from_hash:: id=$id, key1=$key1, key2=$key2, key3=$key3, key4=$key4, key5=$key5");
if ( defined $key6 ) {
$value = $$hash{hits}{hits}[$id]{$key1}{$key2}{$key3}{$key4}{$key5}{$key6};
}
elsif ( defined $key5 ) {
$value = $$hash{hits}{hits}[$id]{$key1}{$key2}{$key3}{$key4}{$key5};
}
elsif ( defined $key4 ) {
$value = $$hash{hits}{hits}[$id]{$key1}{$key2}{$key3}{$key4};
}
elsif ( defined $key3 ) {
$value = $$hash{hits}{hits}[$id]{$key1}{$key2}{$key3};
}
elsif ( defined $key2 ) {
$value = $$hash{hits}{hits}[$id]{$key1}{$key2};
}
}
elsif ( $att =~ m/!!DELIMITER!!.+!!/ ) {
&Debug("get_value_from_hash:: parsing the DELIMITER attribute - $att");
my $delimiter = $att;
$delimiter =~ s/!!DELIMITER!!(.*)!!.*/$1/;
$att =~ s/!!DELIMITER!!.+!!//;
&Debug("get_value_from_hash:: parsing the attribute - $att");
my ( $key1, $key2, $key3, $key4, $key5, $key6 ) = split( $delimiter, $att );
# &Debug("get_value_from_hash:: key1=$key1, key2=$key2, key3=$key3, key4=$key4, key5=$key5, key6=$key6");
if ( defined $key6 ) {
$value = $$hash{$key1}{$key2}{$key3}{$key4}{$key5}{$key6};
}
elsif ( defined $key5 ) {
$value = $$hash{$key1}{$key2}{$key3}{$key4}{$key5};
}
elsif ( defined $key4 ) {
$value = $$hash{$key1}{$key2}{$key3}{$key4};
}
elsif ( defined $key3 ) {
$value = $$hash{$key1}{$key2}{$key3};
}
elsif ( defined $key2 ) {
$value = $$hash{$key1}{$key2};
}
}
else {
&Debug("get_value_from_hash:: parsing the attribute - $att");
my ( $key1, $key2, $key3, $key4, $key5, $key6 ) = split( /\./, $att );
#&Debug("get_value_from_hash:: key1=$key1, key2=$key2, key3=$key3, key4=$key4, key5=$key5");
if ( defined $key6 ) {
$value = $$hash{$key1}{$key2}{$key3}{$key4}{$key5}{$key6};
}
elsif ( defined $key5 ) {
$value = $$hash{$key1}{$key2}{$key3}{$key4}{$key5};
}
elsif ( defined $key4 ) {
$value = $$hash{$key1}{$key2}{$key3}{$key4};
}
elsif ( defined $key3 ) {
$value = $$hash{$key1}{$key2}{$key3};
}
elsif ( defined $key2 ) {
$value = $$hash{$key1}{$key2};
}
}
When you try to debug, why value is not filled, and find this...