The seekdir sets the current position for readdir() on the directory filehandle.
The position is set by the a value returned by telldir().
opendir(DIR, "."); # current directory
while( $myfile=readdir(DIR) ){
$spot=telldir(DIR);
if ( "$myfile" eq ".login" ) {
print "$myfile\n";
last;
}
}
rewinddir(DIR);
seekdir(DIR, $spot);
$myfile=readdir(DIR);
print "$myfile\n";
Related examples in the same category