my %ds1_tables = (); my %ds2_tables = (); foreach my $key (keys %{$DS1{PERL}[0]{TABLES}}) { $ds1_tables{$key} = 1; } foreach my $key (keys %{$DS2{PERL}[0]{TABLES}}) { $ds2_tables{$key} = 1; } foreach my $key (keys %ds1_tables) { if (!exists $ds2_tables{$key}) { print "$key does not exist in table 2.\n"; } else { print "$key exists in table 2.\n"; } }