Oh God,...Tried few things to no avail!
But I think I know what to do - ...I think!! - I will go through the %vals and get apps names, save the apps names in an array, go through each element in the array and rematch it against the %vals again and obtain the InstallSource this time round...I will give this a spin and see
Thanks for your help.
I'll be back.
btw: how do I get rid of the empty registry entries?
this is an example of the registry dump of an empty registry record;
$VAR1 = {
'' => [
'',
1,
''
]
};
I tried the followin to to avail!
$x->GetValues(\%vals );
#print Dumper \%vals;
for my $item (keys %vals)
{
#next if ($item eq ''); #din't work
#next if ($item=~ /\W+/g ); # nor did this
#next if ($item=~ /\W/g ); # no
#next if ($item =~ /^[^\w]/); # no
next unless ($item !~ /\W/); #no
print "$item";
}
print "---------\n";
Thanks for the help.
UPDATE1 *******Please ignore the above******
This has worked;
$x->GetValues(\%vals );
#print Dumper \%vals;
$rec->{app} = $vals{DisplayName}[2] if ( exists $vals{Display
+Name});
$rec->{path} = $vals{InstallSource}[2] if ( exists $vals{Inst
+allSource});
print "App : $rec->{app}
print "Path :$rec->{path} \n";
print "---------\n";
but, if the install source doesn't exits the this is display I get back;
Use of uninitialized value in concatenation (.) or string at U:\script
+s\listapps4.pl line 23.
App :
---------
Use of uninitialized value in concatenation (.) or string at U:\script
+s\listapps4.pl line 23.
App :
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Apple Quicktime Pro 5.0.2
---------
App : Internet Explorer Q837251
---------
And Not sure why is some entries are duplicated
UPDATE2 **********
Ok, This gor rid of the errors
$rec->{app} = $vals{DisplayName}[2] if ( exists $vals{DisplayName});
$rec->{path} = $vals{InstallSource}[2] if ( exists $vals{Inst
+allSource});
print "$rec->{app}" if ($rec->{app});
print "$rec->{path}" if ($rec->{path});
But still don't know why Im still getting duplicates?
UPDATE3 ******************
Ok, I got around it this, but don't know if its the best solution?
$x->GetValues(\%vals );
$rec->{app} = $vals{DisplayName}[2] if ( exists $vals{Display
+Name});
if ( exists $vals{InstallSource})
{
$rec->{path} = $vals{InstallSource}[2];
}
else
{
$rec->{path} = 'N/A';
}
push (@source,$rec) if ($rec->{app});
}
$Key->Close;
}
}
print "\nListing Application information\n";
for my $apps (@source)
{
print "DisplayName\t: $apps->{app}";
print "InstallSource\t: $apps->{path}";
print "------------------------------------------------\n";
}
But it works,...Thanks very much