Sorry my bad, this doesn't work with lines as Andy Lester pointed out.
When i tested it i had a file with one char on each line. My apologies :(

Toby

-----Original Message-----
From: Toby Stuart [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 11:04 AM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: RE: seek function call


change: 
        seek(LOG,0,2);
to:
        seek(LOG,-1,2);


hth

toby

-----Original Message-----
From: William Black [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:42 AM
To: [EMAIL PROTECTED]
Subject: RE: seek function call


Hi all,

I have a quick question about seek().  If I have a file with 100 lines of 
data and I want to seek to the last line of the file and read it. How is 
this done?  Below is what I'm trying to do. A little help please.

File x.pl:
aaaaaaaaa
bbbbbbbbb
ccccccccc
ddddddddd
eeeeeeeee

open(LOG,"x.pl");
seek(LOG,0,2); # I thought 2 meant the end of the file.
$line=<LOG>;
print"$line":
close(LOG);

William Black



_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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

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

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

Reply via email to