XPhiNermal has asked for the wisdom of the Perl Monks concerning the following question:
I would like to have my program generate the following hash tree from that text data:foo sub1 sub2 sub21 sub22 bar camel
I have contemplated various recursive and iterative approaches to this problem, but have yet to come up with anything viable (ergo no code here).my $hash_tree = { foo => { sub1 => '', sub2 => { sub21 => '', sub22 => '' } }, bar => { camel => '' } }
Has anyone here done something similar before, or have a good idea of how to do it?
Thanks in advance, Bill
PS: if it makes a difference in how you would respond to such a question, I'll tell you that I'm proficient with C/C++, but am a relative beginner with Perl.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Reading an arbitrary hierarchy into a hash tree
by abstracts (Hermit) on Aug 07, 2001 at 03:06 UTC | |
Re: Reading an arbitrary hierarchy into a hash tree
by runrig (Abbot) on Aug 07, 2001 at 03:30 UTC | |
Re: Reading an arbitrary hierarchy into a hash tree
by maverick (Curate) on Aug 07, 2001 at 05:22 UTC |