perl-5.38.0
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.

FILEHANDLE の現在の位置を バイト数で 返します; エラーの場合は -1 を 返します。 FILEHANDLE は、実際のファイルハンドル名を示す式でもかまいません。 FILEHANDLE が省略された場合には、最後に読み込みを行なったファイルについて 調べます。

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), the seek, tell, and sysseek family of functions use byte offsets, not character offsets, because seeking to a character offset would be very slow in a UTF-8 file.

バイト単位に対する注意: 例え(例えば :encoding(UTF-8) I/O 層を使うなどして) ファイルハンドルが文字単位で処理するように設定されていたとしても、 seek, tell, sysseek シリーズの関数は 文字オフセットではなくバイトオフセットを使います; 文字オフセットでシークするのは UTF-8 ファイルではとても遅いからです。

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.

STDIN のような標準ストリームに対する tell の返り値は OS に依存します: -1 やその他の値が返ってくるかもしれません。 パイプ、FIFO、ソケットに対して tell を使うと、普通は -1 が返ります。

There is no systell function. Use sysseek($fh, 0, 1) for that.

systell 関数はありません。 代わりに sysseek($fh, 0, 1) を 使ってください。

Do not use tell (or other buffered I/O operations) on a filehandle that has been manipulated by sysread, syswrite, or sysseek. Those functions ignore the buffering, while tell does not.

sysread, syswrite, sysseek で操作された ファイルハンドルに tell (またはその他のバッファリング I/O 操作) を使わないでください。 これらの関数はバッファリングを無視しますが、tell は 違います。