in reply to Re^3: capturing entries from the Registry
in thread capturing entries from the Registry
I tried the followin to to avail!$VAR1 = { '' => [ '', 1, '' ] };
Thanks for the help.$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";
but, if the install source doesn't exits the this is display I get back;$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";
And Not sure why is some entries are duplicated UPDATE2 ********** Ok, This gor rid of the errorsUse 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 ---------
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?$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 it works,...Thanks very much$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"; }
|
|---|