foreach $n (1..50) { print "$n: "; print "yes" if -e <*>; print "\n"; } #### print "Found textfile!" if () = <$dir/*.txt>;