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 reply to Re: Depth Listing in Directory Traversal (one more stack)
by tye
in thread Depth Listing in Directory Traversal
by crabbdean
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |