描述
此函数返回DIRHANDLE引用的目录列表中读指针的当前位置。此返回值可以由seekdir()函数使用。
语法
以下是此函数的简单语法-
telldir DIRHANDLE
返回值
此函数返回目录中的当前位置。
例
以下是显示其基本用法的示例代码,/tmp目录中只有两个文件-
#!/usr/bin/perl -w
opendir(DIR, "/tmp");
print("Position without read : ", telldir(DIR), "\n");
$dir=readdir(DIR);
print("Position after one read : ", telldir(DIR), "\n");
print "$dir\n";
seekdir(DIR,0);
$dir=readdir(DIR);
print "$dir\n";
print("Position after second read : " , telldir(DIR), "\n");
closedir(DIR);
执行上述代码后,将产生以下输出-
Position without read : 0 Position after one read : 1 .ICE-unix .ICE-unix Position after second read : 1
Perl 中的 telldir函数 - 无涯教程网无涯教程网提供描述此函数返回DIRHANDLE引用的目录列表中读指针的当前位置。此返回值可以由seekdir()...
https://www.learnfk.com/perl/perl-telldir.html



















