Do you really need to keep the directory handle open? Cant you just push its content in an arry or save that in any other way? You don't need to keep the dir open if you want to open a subdir of that. And you might think about using File::Find
Have a nice day All decision is left to your taste