sub handle_direntries{ unless ($_[$#_] eq 1){ handle_direntries(handle_direntries_params(@_)); } else{ my $count = 0; my $treeref = \%::treehash; # reference to a hash while ($count != $#::path){ $treeref = \$treeref->{$::path[$count]}; $count++; next if $count == $#::path; unless (defined($treeref->{$::path[$count]})) { $treeref->{$::path[$count]} = {"$::DirLabel" => $::path[$count]} } } $count = 0; while ($count != $#::direntries){ $treeref -> {$::path[$count]}{$::direntry[$count]} = "$::FileLabel" unless $treeref -> {$::path[$count]}{$::direntry[$count]} = "$::DirLabel"; } } }