isync has asked for the wisdom of the Perl Monks concerning the following question:
sub Load { my $dir = shift; find(\&wanted, $dir); for(keys %tree){ my $name = $_; $name =~ s/^$dir//; push( @{ $tree }, { name => $name, value=> 1, # $tree{ $_ } } ); } print Dumper($tree); return $tree; } sub wanted { my $self = shift; push( @{ $tree{ $File::Find::dir } }, $_ ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Building a nested data structure from File::Find
by onelesd (Pilgrim) on Jun 09, 2011 at 22:02 UTC | |
by isync (Hermit) on Jun 09, 2011 at 22:54 UTC | |
|
Re: Building a nested data structure from File::Find
by wind (Priest) on Jun 09, 2011 at 23:27 UTC | |
|
Re: Building a nested data structure from File::Find
by Anonymous Monk on Jun 10, 2011 at 00:29 UTC | |
|
Re: Building a nested data structure from File::Find
by isync (Hermit) on Jun 10, 2011 at 15:54 UTC |