O’ Holy ones

I has been such a long day, although it’s a fairly easy problem……

I have the following script
#! c:/perl/bin -slw use Win32::Registry; use vars qw/%data @source @target/; if ($HKEY_LOCAL_MACHINE->Connect($ARGV[0], my $root)) { print "\nSuccessfully connect to remote registry on $ARGV[0]\n"; if ($root->Open("Software\\Microsoft\\Windows\\CurrentVersion\\Unin +stall", my $Key)) { print "Obtaining software information....Please wait\n"; my @keys; $Key->GetKeys( \@keys ); for my $subkey ( @keys ) { $Key->Open( $subkey, my $x ) or die $^E; my %vals; my $rec; $x->GetValues(\%vals ); for my $item (keys %vals) { $rec->{app} = $vals{$item}[2] if ($item=~ /DisplayName/i); $rec->{path} = $vals{$item}[2] if ($item=~ /InstallSource/ +i); print "$rec->{app} : $rec->{path}\n"; #push (@source, $rec); } } } }
I am trying to capture only the applications ‘DisplayName’ and the ‘InstallSource’ off a remote Win32 registry. However, I do not want any empty entries from the Registry – because I will be piping the results into Excel and I want to avoid any errors – Ultimately I would like to create an array of anonymous hashes contaning this information, but I am not able to do this for some reason, …I tried and tried! Can someone please help? Thanks.

In reply to 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.