#! perl -w use strict; use File::Find; my $dirth = dirTreeHash(shift); sub dirTreeHash { my $dir = shift; return unless defined $dir && -d $dir; $dir =~ s#\\#/#g; # Win32 :-( my $dirth = {}; find sub { return if -d; eval join '', '$dirth->', ( map { '{\'' . $_ . '\'}' } split '/', $File::Find::name ), '=""'; warn $@ if $@; }, $dir; $dirth; } # dump it use Data::Dumper; $Data::Dumper::Indent = 1; print Dumper $dirth; # browse it use Tk::ObjScanner; MainWindow->new->ObjScanner(caller => $dirth)->pack; Tk::MainLoop; __END__ H:\devperl\perlmonks\TryDirTreeHash.pl H:\devperl\PerlMonksChat2 $VAR1 = { 'H:' => { 'devperl' => { 'PerlMonksChat2' => { 'README' => '', 'ChangeLog' => '', 'Makefile' => '', 'getchat.pl' => '', 'getpage.pl' => '', 'getchat.old.pl' => '', 'test' => { 'testnn.pl' => '', 'nodetypes' => '' }, 'PerlMonks' => { 'Users.pm' => '', 'NewestNodes.pm' => '', 'Chat.pm' => '' }, 'Noname6.pl' => '', 'PerlMonks.pm' => '', 'pmpager.pl' => '', 'PerlMonksChat.pm' => '', 'pmchat' => '' } } } };