in reply to Depth Listing in Directory Traversal

In general, when doing queue-based-recursion, just unshift onto the queue, rather than pushing.

my @queue = ( $start ) { while ( my $thing = shift @queue ) { do_something_with( $thing ); unshift @queue, $thing->children; }

I'm assuming this is what you are after?