in reply to Skipping files in a directory

While working on files or directories, use File Test Operators, to test different aspects of a file.
open(FH, "txtfile") or die "Cannot open the file"; while (<FH>) { chomp($_); if (-d $_) { ---do your stuff here } else { print "Directory does not exist"; } } close(FH);