in reply to Categories. Table of Contents. Trees?
As an aside, I think Perl lends itself quite naturally to tree structures. Having references makes building trees very simple. For example, consider a table of contents:
my %contents = ( 1 => [ 'Introduction', undef ], 2 => [ 'Design', { 1 => [ 'Wheels', undef ], 2 => [ 'Frame', undef ], 3 => [ 'Electronics', { 1 => [ 'Dashboard', undef ], 2 => [ 'Fuel Injection', undef ], }, 4 => [ 'Petrol Tank', undef ], }, 3 => [ 'Summary', undef ], );
Merely defining things these ways is, by definition, a tree. If references are tripping you up, then read about pointers.. and re-read until you become more comfortable with this concept.
|
|---|