http://www.perlmonks.org?node_id=260692


in reply to visit directories and more...

use File::Find;
and see the tutorials section as well as the code section

Have a nice day
All decision is left to your taste

Update
See Beginners guide to File::Find