Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL telldir Function
Syntax
Definition and Usage
Returns the current position of read pointer within the directory listing referred to by DIRHANDLE. This returned value can be used by seekdir() function.
Return Value
Example
In this example we have only two files in /tmp directory.
#!/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);
|
It will produce following results:
Position without read : 0
Position after one read : 1220443271
test.txt
test.txt
Position after second read : 1220443271
| |
|

|
|
|