Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Build tree data structure from DB (flat) data; function golf

by gryphon (Abbot)
on Aug 30, 2006 at 15:32 UTC ( #570409=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub tree_data {
      my ( $old_data, $key_name, $next_group, @remaining_keys ) = @_;
    ...
    
      return \@new_data;
    }
    
  2. or download this
    my $input = [
      {
    ...
        'other_data' => '123456789',
      },
    ];
    
  3. or download this
    my $output = [
      {
    ...
        ],
      },
    ];
    
  4. or download this
    # ...to generate the output example from above...
    my $output = tree_data( $input, 'team', 'employees' );
    ...
    my $output = tree_data(
      $input, 'team', 'employees', 'employee', 'work_days'
    );
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://570409]
Approved by McDarren
Front-paged by shmem
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2015-07-01 23:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (24 votes), past polls