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

In reply to Re^4: capturing entries from the Registry by blackadder
in thread capturing entries from the Registry by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.