in reply to Scanning static directory tree for files

To a certain extent it depends on the size and number of the directories. You could use glob to grab all of the entries in a directory. i.e.
@files = glob("*.mp3");
That would get you a list of mp3s in the current directory. To transverse directories, you would want something like...
while (glob("*")) { if ( ! ( $_ =~ /^\./ ) ) { if ( -f $_ ) { #process files in this directory. } elsif ( -d $_ ) { #process a directory possibly with a recursive call } } }
By putting the above in a function and calling it recursively, you could actually scan down the entire tree. This of course can also be done with opendir etc. which is what you are doing I assume.
Most of the various possibilities for this scenario were fairly well fleshed out in another thread on perlmonks...
Can't seem to find it at the moment though, so someone else will have to give you the link.