Here is an example from the file:
HKEY_LOCAL_MACHINE\SOFTWARE\Vendor\Product\CurrentVersion\Tokens\Encotone\SerialNumberUserAttribute=12345
LanMan:= ; REG_SZ
LDAP:= ; REG_SZ
ODBC:= ; REG_SZ
I am trying to figure out how to take the HKEY_LOCAL_MACHINE line and build a hash of hashes. If I were building the hash manualy, I would normally do it like this:
The problem is that I am parsing a textfile and trying to build the hash of hashes dynamically, because I don't know which registry-like keys will be included.$hash{'HKEY_LOCAL_MACHINE'}{'SOFTWARE'}{'Vendor'}{'Product'}{'CurrentV +ersion'}{'Tokens'}{'Encotone'}{'SerialNumberUserAttribute'}=12345; $hash{'HKEY_LOCAL_MACHINE'}{'SOFTWARE'}{'Vendor'}{'Product'}{'CurrentV +ersion'}{'Tokens'}{'Encotone'}{'SerialNumberUserAttribute'}{'LanMan'} +{'Value'}=""; $hash{'HKEY_LOCAL_MACHINE'}{'SOFTWARE'}{'Vendor'}{'Product'}{'CurrentV +ersion'}{'Tokens'}{'Encotone'}{'SerialNumberUserAttribute'}{'LanMan'} +{'Type'}="REG_SZ"; $hash{'HKEY_LOCAL_MACHINE'}{'SOFTWARE'}{'Vendor'}{'Product'}{'CurrentV +ersion'}{'Tokens'}{'Encotone'}{'SerialNumberUserAttribute'}{'LDAP'}{' +Value'}=""; $hash{'HKEY_LOCAL_MACHINE'}{'SOFTWARE'}{'Vendor'}{'Product'}{'CurrentV +ersion'}{'Tokens'}{'Encotone'}{'SerialNumberUserAttribute'}{'LDAP'}{' +Type'}="REG_SZ"; $hash{'HKEY_LOCAL_MACHINE'}{'SOFTWARE'}{'Vendor'}{'Product'}{'CurrentV +ersion'}{'Tokens'}{'Encotone'}{'SerialNumberUserAttribute'}{'ODBC'}{' +Value'}=""; $hash{'HKEY_LOCAL_MACHINE'}{'SOFTWARE'}{'Vendor'}{'Product'}{'CurrentV +ersion'}{'Tokens'}{'Encotone'}{'SerialNumberUserAttribute'}{'ODBC'}{' +Type'}="REG_SZ";
Of course I will need another variable to store where in the hash the current key is to add the "Key name", "Value" , and "Type" for the lines that follow the HKEY... line, but I am not too concerned about that right now.
Anybody have any ideas?
In reply to split string into hash of hashes... by bcarroll
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |