perl的tell函数,注解都是英文,大家慢慢研读吧。
函数名 tell
调用语法 tell (filevar);
解说 返回从文件头到当前位置的距离。
Syntax
tell FILEHANDLE
tell
Definition and Usage
Returns the current position of read pointer (in bytes) within the specified FILEHANDLE. If FILEHANDLE is omitted, then it returns the position within the last file accessed.
Return Value
Current file position in bytes
Example
To check this function do the followings
Create a text file with "this is test" as content and store it into /tmp directory.
Read 2 charcters from this file.
Now check the position of read pointer in the file.
It will produce following results:
First Charctaer is T
Second Charctaer is h
Position with in file 2