%{$view} = ( 108A => {4=>[ 52, 54, 56.5, 34 ]}, 108A => {4=>[ 23, 55 ],6=>[21, 55]), 1069 => [ 45.1, 33], 1069 => {4=>[ 45, 29.2, 36], 6=>[33, 65, 87 ]}, 1069 => {4=>[ 47, 29, 39, 13.6 ]}, 108A => [ 34, 33], 1069 => {4=>[ 31, 32.3, 51], 6=>[23, 45, 12.5], 7=>[23,45.6,12]}, 1069 => {4=>[ 35.1, 22, 40], 9=>[12, 12, 11.5] } ); #### do{ my $tmp=$nextlog->getNextLogFromView($view); if($tmp ne -1){ if(getLogCode($tmp) eq 108A){ $obj = parse0($tmp); my @pns = keys(%{$obj->{sectors}}); for(my $i=0;$i<$obj->{numSectors};$i++){ #for each sector my $sector = $pns[$i]; for(my $j=0;$j<$obj->{sectors}->{$sector}->{numFingers};$j++){ $myc2i=$obj->{sectors}->{$sector}->{$j}->{c2i}; DO SOMETHING #<--- Not sure where to put this. I want help to throw out all the values of myc2i for each occurance of logcode of type 108A and then add it with the average of the two values inside logcode of type 1069. Fml. And that is only phase 1. } } if(getLogCode($tmp) eq 1069){ $obj = parse1($tmp); for (my $j=0;$j<2;$j++){ $averageAgc=$obj->{$j}{'rxAgc0'}; #<-- I was trying to add the two values together and throw out the sum to some variable. I also want to store the values of the last occurance of 1069 someplace in order for DO SOMETIHNG to fetch it to add them. } } } } while($tmp ne -1); sub DO SOMETHING{ my $multipath = shift; my ($calc); for (my $i=0; $i < $multipath->myc2i; $i++) { #NOT SURE HOW TO ADD average from 1069 (which has two values) with every single myc2i or values the array inside second hashes. } }