Dave Sherohman <[EMAIL PROTECTED]> writes:

> On Wed, Jan 09, 2008 at 09:45:15PM -0800, Sam wrote:
>> if i read you correctly, you can read the file into an array and use pop,
>> which will return the last element read.Or you could use @array[-1]
>
> That's rather wasteful of memory, which becomes a concern with larger
> files.  If the objective is indeed to get the last line in the file,
> then you only need a scalar to stick each line into and its final stored
> value will be the last line:

Or use File::ReadBackwards, which will generally do this in a much
more efficient way.  It's in Debian package libfile-readbackwards-perl.

----Scott.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to