Then you should look at opendir, readdir, and closedir. You should still check the return status of those functions also (in the same way as open -- update: actually just check the status of opendir).
Comment on Re^3: Question mark regarding: my @lowest_priority = <LOWEST>;