in reply to Re: directory listing to array tree
in thread directory listing to array tree

Sorry guys, couldn't log in earlier.
++ikegami golf. I shall spend tomorrow trying to decypher it ; )

Re: "show us 'yer code!" I was working backwards from the last node towards the root node but was hitting 20 lines+.
The PHP was very similar to my perl attempt, which of course made me weep buckets.

c

Replies are listed 'Best First'.
Re^3: directory listing to array tree
by Anonymous Monk on Sep 15, 2009 at 06:42 UTC
    Re: "show us 'yer code!" I was working backwards from the last node towards the root node but was hitting 20 lines+.

    Show your code anyway.

    #!/usr/bin/perl -- use strict; use warnings; use Tree::Builder; my $tb = Tree::Builder->new(); my @list = qw[ /var/www/data/stuff /var/www /var/www/data/misc /var/logs /var/logs/data ]; $tb->add($_) for @list; use Data::Dumper; print Dumper( { $tb->getTree } ); __END__ $VAR1 = { '' => { 'var' => { 'www' => { 'data' => { 'misc' => {}, 'stuff' => {} } }, 'logs' => { 'data' => {} } } } };