filmo has asked for the wisdom of the Perl Monks concerning the following question: ⭐ (directories)
I've looked at File::Recurse and File::Find, but they both don't seem to handle sub-directories as I'd like. What I'm looking for is a nested hash of the directory, its files and sub-directories. i.e.
If the top directory is "home" and one of the subdirectories is 'user1', I would like be able to access the files as%result = ('top' =>[ file1, file2, file3, subdir1 => [sub_file1, sub_file2], subdir2 => [sub_file3, sub_subDIR =>[sub_sub_file1]], etc... ]);
$result{'home'}[0] $result{'home'}{'user1'}[0] $result{'home'}{'user1'}[1], etc
Originally posted as a Categorized Question.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How do I get directory structure into a hash?⭐
by Aristotle (Chancellor) on Dec 15, 2002 at 01:16 UTC | |
Re: How do I get directory structure into a hash?⭐
by BrowserUk (Patriarch) on Dec 15, 2002 at 07:58 UTC | |
Re: How do I get directory structure into a hash?⭐
by merlyn (Sage) on Dec 15, 2002 at 00:17 UTC | |
Re: How do I get directory structure into a hash?
by filmo (Scribe) on Dec 15, 2002 at 01:01 UTC | |
Re: How do I get directory structure into a hash?
by BrowserUk (Patriarch) on Dec 15, 2002 at 07:57 UTC | |
Re: How do I get directory structure into a hash?
by anandsridharan (Initiate) on Nov 29, 2011 at 04:06 UTC | |
Re: How do I get directory structure into a hash?
by anandsridharan (Initiate) on Nov 29, 2011 at 04:17 UTC |
Back to
Seekers of Perl Wisdom