closedir DIRHANDLE |
关闭目录句柄DIRHANDLE。
失败返回 0
成功返回 1
#!/usr/bin/perl -w $dirname = "/tmp"; #by www.gitbook.net opendir ( DIR, $dirname ) || die "Error in opening dir $dirname\n"; while( ($filename = readdir(DIR))){ print("$filename\n"); } closedir(DIR);
这将产生以下结果:
. .. testdir