Perl Programming/Keywords/tell

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: syswrite Keywords Next: telldir

The tell keyword[edit | edit source]

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 | edit source]

  tell FILEHANDLE
  tell
Previous: syswrite Keywords Next: telldir