in reply to Depth Listing in Directory Traversal
Where you push @{ $self->{dirs} },... you need to add push @{ $self->{levels} }, 1+$self->{level};. When you shift off of $self->{dirs}, also do $self->{level} = shift @{ $self->{levels} };.
You can do it in more memory-efficient ways but the added complexity seems not worth it.
- tye
In Section
Seekers of Perl Wisdom