use File::Find; [...] my @fileList; find(\&wanted, qw($myDirectory)); sub wanted { if (-f $File::Find::name) { push(@fileList, "$File::Find::name) } } print "You've found " . join("\n\t", @fileList) . "\n";