my $info1 = grok_file $file1; my $info2 = grok_file $file2; MODULE: while ( my ($module, $nets_href) = each %$info1 ) { unless ( $info2->{$module} ) { warn "$file2 has no module $module"; next MODULE; } NET: while ( my ($net, $gates_href) = each %$nets_href ) { unless ( $info2->{$module}->{$net} ) { warn "$file2 has no net $module/$net"; next NET; } GATE: while ( my ( $gate, $href1 ) = each %$gates_href ) { my $href2 = $info2->{$module}->{$net}->{$gate}; unless ( $href2 ) { warn "$file2 has no gate $module/$net/$gate"; next GATE; } diff_gates "$module/$net/$gate", $href1, $href2; } # GATE } # NET } # MODULE