in reply to Re^3: process array with while loop
in thread process array with while loop

In order to to allow "", 0, undef, etc in the array, the general form would be

while (@array) { my $item = shift @array; # or pop ... push(@array, ...); # or unshift ... }

(It's not a problem in your case since every item in @dirs starts with ..)

This model is useful to perform recursive processes without using recursion.