use File::Find; sub myprint {print "$_\n" unless -d($_)} # i.e. print anything that's not a directory find(\&myprint,'/your/directory');