use File::Find;find sub { $File::Find::prune = 1 if /dir1/; print "Here's a text file: $File::Find::name\n" if -T }, '.';