for my $key (keys %mappings) { for (keys %{$mappings{$key}}) { next if $mappings{$key}{$_} < 2; print "$key - $mappings{$key}{$_} -> $_\n" ; } } #### lung cancer - 2 -> some cancer cancer - 4 -> foot cancer