Site menu:

Back to examples

Perl Example - Search Windows registry and delete all occurences of a particular string

#################################################
#Version 0.1                                    #
#Free to use for any purpose                    #
#No credits or backlink required                #
#Author : Shaji Kalidasan (shajiindia@yahoo.com)#
#################################################
use Win32::TieRegistry( Delimiter => "/", ArrayValues => 0 );

my $RegHash =
  $Registry->{"HKEY_CURRENT_USER/Software/MySQL AB/MySQL Server 5.5"}
  or die "Can't find the Windows Registry: $^E\n";

my @keys = grep /installed/, keys %$RegHash;

print join "\n", @keys;

foreach (@keys) {
	delete $RegHash->{$_};
}