tcf03 has asked for the wisdom of the Perl Monks concerning the following question:

Im trying to traverse the windows registry (W2k) Ive started with this small bit of code, which pretty much works the way I expect it to. Im just having trouble moving on - my goal is to pull out a list of installed software and the versioning information. Any tips would be appreciated.
use warnings; use strict; use Win32::TieRegistry ( TiedHash => '%RegHash' ); my $Registry=\%RegHash; my @reg=%{ $Registry->{"HKEY_CLASSES_ROOT\\batfile\\"} }; for ( @reg ) { print "$_\n"; }


Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson

Replies are listed 'Best First'.
Re: Windows Registry - printing keys
by ikegami (Patriarch) on Nov 28, 2005 at 15:37 UTC

    I think you'll get what you want if you change
    my @reg= %{ ... };
    to
    my @reg= keys %{ ... };

    Also, $Registry is already provided to you.

    use strict; use warnings; use Win32::TieRegistry; my @reg = keys %{ $Registry->{"HKEY_CLASSES_ROOT\\batfile\\"} }; for ( @reg ) { print "$_\n"; }

    outputs

    DefaultIcon\ shell\ shellex\ \ \EditFlags