foreach my $software (keys %bad_stuff) { if($subkey =~ $bad_stuff{$software}) { next if($installed_software{$machine.$software}++); print "Machine $machine could have $software installed\n"; } } #### foreach my $subkey ($user_key->SubKeyNames,$software_key->SubKeyNames) { if ( exists $bad_stuff{$subkey} ) { print "Machine $computer could have $subkey installed\n"; } }