Maybe these are not the best methods to do really large text files...
The best solution is to index the file and jump directly to a line you want.
Or you can use the DBM access method to do the same...a simpler is of course
the indexing method and takes minimal memory...
sub build_idx{
my $data_file =shift;
my $index_file = shift;
my $offset = 0;
while(<$data_file>) {
print $index_file pack("N", $offset);
$offset = tell($data_file);
}
}
somethiung like this and then read the indexed line.......from the index file
and access onto the mail file...
regards
vivek
On Friday 08 February 2002 11:26 am, Octavian Rasnita wrote:
> Hi all,
> I want to read a text file line by line and to make some changes in some
> lines.
> Which method do you recommend?
>
> To store the file in an array, then to insert the changed value in that
> array, and then to write that array to the file, or to use a temporary file
> to store each line from the source file and twhen I want to modify a line,
> I have just to insert it in the temporary file.
>
> I ask this because I don't know if using the first method it will eat my
> whole memory.
> Thanks!
>
> Teddy,
> My dear email address is [EMAIL PROTECTED]
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]