use File::Find; find (\&for_every_name, (C:/temp, C:/Windows); my @allFiles; sub for_every_name { print "$File::Find::name\n"; # note there is no "return value" # it is not possible to return anything from this # subroutine # If you want that: push @allFiles, $File::Find::name; # you must save information in a varialble that has higher # scope than this subroutine # There is NO return value from this subroutine! }