Help for this page

Select Code to Download


  1. or download this
    my $input = {
        'Sally Smith'   => { parents => ['Bob Smith',    'Rhonda Smith']},
    ...
        'Betty Boop'    => { parents => ['Rhonda Smith', 'Louis McFern']},
        'Jim Morris'    => { parents => ['Betty Boop',   'John Wayne']},
    };
    
  2. or download this
    my $people = {};
    for my $m (keys %$input) {
    ...
                ref($params{$par}) eq "ARRAY" ? @{$params{$par}} : $params
    +{$par};
        }
    }
    
  3. or download this
    {
      "Betty Boop"    => { children => ["Jim Morris"], parents  => ["Rhond
    +a Smith", "Louis McFern"], },
    ...
      "Rhonda Smith"  => { children => ["Sally Smith", "Betty Boop"], pare
    +nts => [] },
      "Sally Smith"   => { children => [], parents => ["Bob Smith", "Rhond
    +a Smith"] },
    }
    
  4. or download this
    for my $top_level (sort keys %$people) {
        next if @{ $people->{$top_level}{parents} };
    ...
            print_level($people,$child,$level+1);
        }
    }
    
  5. or download this
    Bob Smith
      Sally Smith
    ...
      Sally Smith
      Betty Boop
        Jim Morris