CARVIEW |
- #tell FILEHANDLE
- #tell
-
Returns the current position in bytes for FILEHANDLE, or -1 on error. FILEHANDLE may be an expression whose value gives the name of the actual filehandle. If FILEHANDLE is omitted, assumes the file last read.
Note the emphasis on bytes: even if the filehandle has been set to operate on characters (for example using the
:encoding(UTF-8)
I/O layer), theseek
,tell
, andsysseek
family of functions use byte offsets, not character offsets, because seeking to a character offset would be very slow in a UTF-8 file.The return value of
tell
for the standard streams like the STDIN depends on the operating system: it may return -1 or something else.tell
on pipes, fifos, and sockets usually returns -1.There is no
systell
function. Usesysseek($fh, 0, 1)
for that.Do not use
tell
(or other buffered I/O operations) on a filehandle that has been manipulated bysysread
,syswrite
, orsysseek
. Those functions ignore the buffering, whiletell
does not.
Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via the GitHub issue tracker or email regarding any issues with the site itself, search, or rendering of documentation.
The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the Perl issue tracker, the mailing list, or IRC to report any issues with the contents or format of the documentation.