use File::Find; sub process_file { #do what you want to a file } find(\&process_file, /this/is/a/directory/to/parse