use strict; use File::Find; open (FOO, ">>filelist.txt"); find(\&TEST_FOR_AGE, '.'); sub TEST_FOR_AGE { print "$File::Find::name\n"; if (!( -e "$File::Find::name")){ print "Help $File::Find::name doesn't exist!!"; exit; } if ((-M "$File::Find::name" >= 30) && (-f "$File::Find::name")) { print FOO "$File::Find::name\n"; } print "\n"; } close FOO;