#! /usr/local/bin/perl
use Cwd;
$dir = cwd;
print "dir=> $dir\n";
opendir(THISDIR, "$dir");
@dirList = <THISDIR>;
print "OPEN @dirList\n";
$loc = telldir THISDIR;
print "Before Rewind Loc ==> $loc\n";
rewinddir THISDIR;
$loc = telldir THISDIR;
print "After Rewind Loc ==> $loc\n";
rewinddir THISDIR;
do {
$tellSpot[$i++] = telldir THISDIR;
} while (readdir THISDIR);
print "\n\nUsing seek to reset the directory handle\n\n";
for ($i = 2; $i <= $#tellSpot; $i++){
seekdir (THISDIR,$tellSpot[$i]);
$fn = readdir THISDIR;
print"$fn\n";
}
closedir THISDIR;
|