go ahead... be a heretic | |
PerlMonks |
split string into hash of hashes...by bcarroll (Pilgrim) |
on Mar 03, 2013 at 01:15 UTC ( [id://1021474]=perlquestion: print w/replies, xml ) | Need Help?? |
bcarroll has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to figure out how to split a string (line of a text file) into a hash of hashes. The textfile looks very much like the Windows Registry. There are some lines that contain a registry like path, with backslashes delimiting key paths.
Here is an example from the file:
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. 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?
Back to
Seekers of Perl Wisdom
|
|