in reply to Re^2: Struggling with complex data structures and doing useful operations on their elements and populating from arrays
in thread Struggling with complex data structures and doing useful operations on their elements and populating from arrays
Loading @info into such %pets will not be difficult and %pets will allow you to produce a report in any format you want, so this is fairly flexible. I will not give code examples for these tasks due to time constraints and I should also say this hash structure is one of many approaches, but this one should work easily. It will allow you to extend the information in the future, e.g. add name, date of birth to each pet, height, weight, additional nicknames, additional colors, whatever you need. Hope this helps.%pets = ( "Thompson" => { "Bill" => { dogs => [ { colors => ["black"], }, ], cats => [ { colors => ["brown"], }, { colors => ["white"], }, ], hamsters => [ { colors => ["black"] }, ], }, }, "Owens" => { "Mary" => { cats => [ { colors => ["white"], }, ], } }, );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Struggling with complex data structures and doing useful operations on their elements and populating from arrays
by Laurent_R (Canon) on Mar 12, 2015 at 22:56 UTC |