unless(readdir(ORIG)) { print "Error 2"; ## not a very informative report! } else { ...