Perl Programming/Keywords/tell

Previous: syswrite Keywords Next: telldir

The tell keyword

edit

The tell function returns the current position in FILEHANDLE or -1 on error, where FILEHANDLE can be an expression. Without the FILEHANDLE parametre, the last read file is assumed.

If the FILEHANDLE has been marked as :utf8 Unicode, characters are read instead of bytes, and the return value of sysread() is in Unicode characters).

The return value of tell() changes for the standard streams like STDIN depending on the operating system. It may return -1 or something else. On fifos, pipes, and sockets, tell() usually returns -1.

As no systell() function does not exist, one can use systell(FH, 0, 1) instead.

Syntax

edit
  tell FILEHANDLE
  tell
Previous: syswrite Keywords Next: telldir