Pathologically Eclectic Rubbish Lister | |
PerlMonks |
perlfunc:seekby gods (Initiate) |
on Aug 24, 1999 at 22:43 UTC ( [id://300]=perlfunc: print w/replies, xml ) | Need Help?? |
seekSee the current Perl documentation for seek. Here is our local, out-dated (pre-5.6) version: seek - reposition file pointer for random-access I/O
seek FILEHANDLE,POSITION,WHENCE
Sets FILEHANDLE's position, just like the
If you want to position file for sysread() or syswrite(), don't use
seek() -- buffering makes its effect on the file's system position unpredictable
and non-portable. Use
On some systems you have to do a seek whenever you switch between reading and writing. Amongst other things, this may have the effect of calling stdio's
seek(TEST,0,1);
This is also useful for applications emulating If that doesn't work (some stdios are particularly cantankerous), then you may need something more like this:
for (;;) { for ($curpos = tell(FILE); $_ = <FILE>; $curpos = tell(FILE)) { # search for some stuff and put it into files } sleep($for_a_while); seek(FILE, $curpos, 0); } |
|