$U = "a"; $V = 1; $W = $U.$V; $folder_to_populate_from=~s` `\\ `g; @things=<$folder_to_populate_from/*>; foreach $thing (@things){ if(-f $thing){push(@FILES,$thing)} if(-d $thing){ push(@DIRS,$thing); $THNG=~s` `\\ `g; @dir=<$THNG/*>; push(@$W,@dir); } } &cycle; sub cycle{ foreach $thing (@$W){ if(-f $thing){push(@FILES,$thing)} if(-d $thing){ push(@DIRS,$thing); $THNG=~s` `\\ `g; @dir=<$THNG/*>; push(@X,@dir); } } if($#X > -1){++$V;$W = $U.$V;@$W=@X;@X=();&cycle} }#cycle 1;