Whatever, I really wonder why people insist so much in reinventing the wheel where a simple glob would do.
That's because a simple glob will get you in trouble in production code. For example...
my @dirs=grep -d, </usr/darren/*>; # Whoa it's one line!!
Yeah it's on one line and looks elegant. Unfortunately there is no error control and it skips directories with a leading '.' in the name (e.g. '.foo', '..bar'). With readdir you need to be a little careful, but it works fine. If you aren't chdir'd into the directory you are reading you generally need to prepend the directory path to each name it returns, but that's trivial.