This is an easy mistake to make.  If you read the documentation
getpos returns an "opaque" value.  This means, briefly, that it
is implementation-dependent what's in it.  But it is guaranteed
to return you to that location if you use it as an argument to
setpos.

Because I happen to know that, in the Windows world, file pointers
are 32-bit unsigned integers, I can unpack it accordingly to get
a visible value.  BUT NOTE THAT DOING THIS INTRODUCES A MACHINE-
DEPENDENCY!  So don't do it if you can avoid it.

Here's what I did:

use FileHandle;
my $fh = new FileHandle "c:\\winzip.log","r";
my $pos = 0;
while(<$fh>)
{

print;
print "-----------------------------------------------------";
$pos = $fh ->getpos;
print unpack('%L',$pos)."\t";
}
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to