此功能将DIRHANDLE中的当前位置设置为POS。 POS的值必须是Telldir先前返回的值。
seekdir()函数类似于Unix seekdir()系统调用。
以下是此函数的简单语法-
seekdir DIRHANDLE, POS
如果失败,此函数返回0,如果成功,则返回1。
以下是显示其基本用法的示例代码,在/tmp内创建一个目录testdir-
链接:https://www.learnfk.comhttps://www.learnfk.com/perl/perl-seekdir.html
来源:LearnFk无涯教程网
#!/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 : 4 . . Position after second read : 4
这一章《Perl - seekdir函数》你学到了什么?在下面做个笔记吧!做站不易,你的分享是对我们最大的支持,感谢!😊
使用 dask 将 iterable.product 的核心转换为 numpy/dask 数组(...
我正在try 堆叠、融化、grouby 或reshape Pandas DataFrame
在 postgresql 中实现 UML 类:创建类型与创建表