I am trying to just check and see if a certain registry key exist. What I currently have will print even if the registry key does not exist. How can I correct this. Here is what I have:
strict; use Win32; use Win32::Registry; # declare variables my ( $regkey, $regobject, %regvals, ); .... .... # SUBROUTINES: # ============ sub CheckForRegistryKey { my($file) = @_; $file1 = $ENV{WINDIR} . "\\system32\\msxml3.dll"; $file2 = $ENV{WINDIR} . "\\system32\\msxml3a.dll"; $file3 = $ENV{WINDIR} . "\\system32\\msxml3r.dll"; # check the registry to see if the registry key exist $regkey = "Software\\Microsoft\\Installer\\Products\\544ADF5B4CAC6AB48ABF7A12B24D93ED" ; if ($main::HKEY_CURRENT_USER->Open($regkey, $regobject)) { $regobject->GetValues(\%regvals); $envVar = ProductName; if($regvals{$envVar}->[2] == "Microsoft SML Parser") { #print "Registry Value : " . $regvals{$envVar}[2] . "\n"; } } } _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs