Warning: I know nothing about Win32::Registry, but nonetheless, I tried to see if I could learn something from your post.

There are 4 bits of code that are repeated over. Maybe a loop over your various definitions of $p might be in order.

But this bit of code definately confuses me...

foreach $k (keys %vals) { $key = $vals{$k}; } $CurrVer->SetValue("",REG_SZ, "$pathe"); foreach $k (keys %vals) { $key = $vals{$k}; print "$$key[2]\n"; }
Near as I can figure, the 1st foreach loop ends up setting the $key scalar to one of the values in the hash, with no knowledge of what the key ($k) / value ($key) combination is. Note that the manual clearly states that (keys %myhash) returns the keys in a pseudo-random order.

Example

#!/usr/bin/perl # arbitray hash table my %vals = ("1","one","2","two","3","three"); # your code foreach $k (keys %vals) { $key = $vals{$k}; } print "\$key=$key\n"; # add something else to hash table %vals = ("1","one","2","two","3","three","4","four","5","five"); # your code foreach $k (keys %vals) { $key = $vals{$k}; } print "\$key=$key\n";
gives
$key=two $key=five
How this affects the statement
$CurrVer->SetValue("",REG_SZ, "$pathe");
I have no idea, because as I said before, I am not familiar with the windows registry module. But how is $key known by the SetValue function? Is it a global variable??

Sorry not to be of more help, but maybe some of this might help you figure out what your program is really doing, and what it is you want it to do.


In reply to Re: Perl with Windows Registry by Sandy
in thread Perl with Windows Registry by jbrown

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.