Madhu Reddy wrote:

> Hi,
>    How to get first line, last line and no of lines in
> a file.....
>
> is there any perl functions available for that ?
> right now what i am doing is
>
> open file
> while (<FH>
> {
>  $lines++;
> }
> close(FH)
>
> This operation is expensive..
> suppose, if file have millions of records,
> it will take more time....
>
> I think there should be some functions to get those..
> i appreciate u r help....
>
> Thanx in advance
> -Madhu

It depends on how much control you have over the syorage system.  This is really a 
design issue, when you get to mangement of iles of that size.  If I were using such a 
massive file, I would try to access it only through some management mechanism that 
kept track of basic overall information about the larger file.  Could be a simple set 
of name-value pairs, or perhaps asectioned file description.

Then you would manage any additions, de3letions or edits to the file so that the 
associated metadata file is kept updated.  Depending on the way the file is organized, 
it might also be useful to store inidces to bookmarks within the file, so that you can 
use seek methods to locate specific areas.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to