Suppose you don't like the opendir/readdir interface to directories
Why not a regular filehandle?
Then you could do:
use Dir;
my $dh = Dir->open(".") or die ...;
while (<$dh>) {
# Do something with the filename in $_
}
close $dh;
We'll do this by tying the handle in $dh, which will allow us to overload the <...> operator on it