in reply to using an array in a while loop

In addition to choroba's (++) reply above, you might look at File::Find, a core module that does a lot of work for you. File::Find::Rule enables code that I find clearer, but it's not core.

Regards,

John Davies