Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 musing on the Monastery: (10)
As of 2014-07-31 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (248 votes), past polls