On Mon, Aug 20, 2012 at 2:00 PM, Rajeev Prasad <[email protected]> wrote:
> is this default behaviour? how to work around this? file is big and I do not
> want to keep in memory as array. so is my only option is to close and open
> the file again?
Yes, that's the default. "seek" lets you reset things though
perldoc -f seek
seek FILEHANDLE,POSITION,WHENCE
Sets FILEHANDLE’s position, just like the "fseek" call of
"stdio". FILEHANDLE may be an expression whose value gives the
name of the filehandle. The values for WHENCE are 0 to set the
new position in bytes to POSITION, 1 to set it to the current
position plus POSITION, and 2 to set it to EOF plus POSITION
(typically negative). For WHENCE you may use the constants
"SEEK_SET", "SEEK_CUR", and "SEEK_END" (start of the file,
current position, end of the file) from the Fcntl module.
Returns 1 upon success, 0 otherwise.
--
a
Andy Bach,
[email protected]
608 658-1890 cell
608 261-5738 wk
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/