use File::Recurse; recurse(\&function, "/path/to/directory/to/recurse"); exit; sub function { shift; print "$_\n" ; }