in reply to Can a hash key have a scalar value and also contain a hash?

"but I don't think it is possible to assign a value to a key that has subkeys under it (hash of hashes), in this case isn't the hash of the subkeys the value?"

Indeed. Each key/value pair in a hash maps precisely one key to precisely one value; so it can't be both a scalar and a hash reference at the same time, though you're of course right that you could use an array there as an extra layer of indirection.

Searching CPAN immediately reveals Win32::Registry::File, and the much newer Parse::Win32Registry. Have you looked at those?

  • Comment on Re: Can a hash key have a scalar value and also contain a hash?

Replies are listed 'Best First'.
Re^2: Can a hash key have a scalar value and also contain a hash?
by bcarroll (Pilgrim) on Jun 23, 2014 at 22:56 UTC
    I did look at some of the Win32 registry modules, but I can't recall why I ended up not using them.

    I am thinking it was because, although the file structure is similar to a Windows registry file, it is different enough to make it incompatible with the available modules, and more complicated than just writing my own parsing subroutine.

    Or I may have just been overwhelmed by the module's source code and got too intimidated to try... I honestly can't remember.