opendir (DH, 'ligand');
my @folder = readdir DH;
for my $file(@folder) {
$count1++;
open (IN_1,"<$file") or die "cannot open:$!\n";
print "$file\n";
}print $count1;
出现
Name "main::IN_1" used only once: possible typo at zuo.pl line 15.
.
..
cannot open:没有那个文件或目录
请问为什么?谢谢!
readdir 返回的结果中,第一个条目是".", 第二个是“..", 挖个当前目录和父目录。用 open 当然无法打开这两个目录了。