Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want to create a nice data structure such asEQUIPMENT: BASEBALL: ACCESSORI EQUIPMENT: BASEBALL: BALLS EQUIPMENT: CYCLING EQUIPMENT: GOLF: BAGS EQUIPMENT: GOLF: BALLS EQUIPMENT: OTHER BALL SPORTS: EQUIPMENT: OTHER BALL SPORTS: EQUIPMENT: RACQUET SPORTS: BAL EQUIPMENT: RACQUET SPORTS: RAQ
What would the algorithm be to convert it ? Reading in the file and splitting is done so I have an array for each line - but I cant think of how to create the array?my %hash = ('EQUIPMENT' => { 'BASEBALL' => { 'ACCESSORI' => 1, 'BALLS' => 1, }, 'CYCLING' => 1, 'GOLF' => { 'BAGS' => 1, 'BALLS' => 1, }, 'OTHER BALL SPORTS' => 1, 'RACQUET SPORTS' => { 'RAQ' => 1, 'BAL' => 1} });
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array to Hash of Hashes
by jethro (Monsignor) on Aug 27, 2009 at 11:39 UTC | |
|
Re: Array to Hash of Hashes
by Anonymous Monk on Aug 27, 2009 at 11:26 UTC | |
|
Re: Array to Hash of Hashes
by bichonfrise74 (Vicar) on Aug 27, 2009 at 21:54 UTC |