If you're planning to filetest the return values out of a readdir(), you'd better prepend the directory in question. Otherwise, because we didn't chdir() there, it would have been testing the wrong file.
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR); closedir DIR;