for(my $i = 0; $i < scalar(@epochList); $i++) { my $line = $epochList[$i]; chomp($line); next if((!$line) || ($line =~ /^;/) || ($line =~ /deleted/)); print $line . "\n" if($debugLevel >= 5); ### if line contains the VOB Tag, read in the following info until next VOB Tag is reached ### VOB Tag is hash key in this case if($line =~ /^\s*For VOB replica \"(.*)\"\s*/i) { #### create a hash for VOB info, with VOB Tag as key $tmpVOBTag = $1; $vobInfoHashRef = $epochFileHash{$1} ||= {}; print "level 1" . "$_\n"; print "epoch file hash ---" . $epochFileHash{$tmpVOBTag} . "\n"; next; } # Get the replica name. if($line =~ /^\s*Actual oplog IDs for row \"(.*)\"\s*/i) { # Store the key to the hash as replica_name $tmpReplicaName = $1; my $replicaInfoHashRef = ${$epochFileHash{$tmpVOBTag}}{$1} ||= {}; print "level 2" . "$_\n"; print "epoch file hash ---" . ${$epochFileHash{$tmpVOBTag}}{$tmpReplicaName} . "\n"; next; } # Get oplogs rows ##### similar info found previously, but only once ##### create an array #### ${$epochFileHash{$tmpVOBTag}}{$tmpReplicaName} if(ref(${$epochFileHash{$tmpVOBTag}}{$tmpReplicaName}) ne "ARRAY") { my $tmpReplicaInfoVal = ""; print"value is not an array" . "\n" if($debugLevel >= 5); $tmpReplicaInfoVal = ${$epochFileHash{$tmpVOBTag}}{$tmpReplicaName}; $vobInfoHashRef->{$replicaInfoHashRef} = (()); push(@{$vobInfoHashRef->{$replicaInfoHashRef}}, $tmpReplicaInfoVal); } ##### already inserted as array, just push new info into array print "value is an array" . "\n" if($debugLevel >= 5); push(@{$vobInfoHashRef->{$replicaInfoHashRef}}, $line); } ##-------------------------------------------------------------------------- ### dump out the whole hash onto the screen, debugging purposes only if($debugLevel >= 0) { print "-" x 50 . "\n"; foreach my $key(keys %epochFileHash) { print "$key-->"; if(ref($epochFileHash{$key}) ne "HASH") { print "$epochFileHash{$key}" . "\n"; } else { # print keys %{ $epochFileHash{$key} }; foreach my $compInfo(keys %{ $epochFileHash{$key} }) { print "$compInfo==>"; if(ref($epochFileHash{$key}->{$compInfo}) ne "ARRAY") { print "$compInfo-->$epochFileHash{$key}->{$compInfo}" . "\n"; } else { print scalar(@{$epochFileHash{$key}->{$compInfo}}); foreach my $compInfoVal(@{$epochFileHash{$key}->{$compInfo}}) { print "$compInfoVal" . "\n"; } } } } print "-" x 30 . "\n"; } }