##
%dir_hash(
'file.txt' => '',
'a' => {
'file.txt' => '',
'b' => {
'c' => {
'file.txt'
##
##
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my %dirhash;
while () {
chomp;
my $last=\%dirhash;
$last=$last->{$_} ||= {} for split qr|/|;
}
print Dumper \%dirhash;
__END__
/file.txt
/a/file.txt
/a/b/c
/a/b/c/file.txt
/z/m/w/file.txt
##
##
my $last=\\%dirhash;
$last=\$$last->{$_} for split qr|/|;