in reply to Return an Array of Sub-Dir Names

Nice idea, I can see how this would come in handy. However, there are a few ways in which this code could be cleaned up a bit.

First, you are using local in places where my would be better. See The difference between my and local for a more indepth discussion... I'd recommend replacing every instance of local with my in the code above.

Second, you have the comment:

#NOTE THE CODE: local($nmbr_items) = @some_array; #DOESNT WORK SO ALWAYS DECLARE IT FIRST.
Which is a *great* comment, because it lets me know what you're thinking and helps me understand why the code is written the way it is. Lets assume you've already followed my advice above and replaced local($nmbr_items) with my($nmbr_items) You'll still have the same issue mentioned in the comment, namely that wrapping  my( ... ) around a variable can alter things somewhat subtly. When used in this manner, my will impose a list context onto the right hand side of the assignment. The return value resulting from evaluating an array in scalar vs. list context is different, so you get different results. The solution is to drop the parens and modify the code to read my $nmbr_items = ... This will behave how you want it to.

Finally, the structure of the code is:

while (read directory) { add to temp array; } examine array to set up loop vars for next loop while (loopvars tell us were still in the loop) { generate return array }
Why not combine the directory reading loop and the return value generating loop.. This elimiates will greatly simplify the code, down to something such as:
my @returnvalue; while(read directory) { skip some bad entries ('.' , '..', and non-dirs) add value to @returnvalue } return @returnvalue;

-Blake