Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Build tree data structure from DB (flat) data; function golf

by gryphon (Abbot)
on Aug 30, 2006 at 19:59 UTC ( #570464=note: print w/ replies, xml ) Need Help??


in reply to Re: Build tree data structure from DB (flat) data; function golf
in thread Build tree data structure from DB (flat) data; function golf

Greetings stvn,

This is awesome. Thanks! I need to reprogram my brain so I'll think to use closures more readily. Maybe I need to re-read HOP. You make a great point about this being a destructive function. I think it's easy to fix, though:

$last_key = delete $_->{ $key_name }; push @{ $build_box }, $_;

...becomes...

push @{ $build_box }, $_; $last_key = delete $build_box->[-1]{$key_name};

UPDATE: I'm a crazy idiot. This doesn't do what I claim it should do. Bad programmer. No cookie. All I'm doing is moving the reference. I need to deep copy instead.

gryphon
Whitepages.com Development Manager (WDDC)
code('Perl') || die;


Comment on Re^2: Build tree data structure from DB (flat) data; function golf
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://570464]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2015-07-05 16:12 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 (67 votes), past polls