I am try-ing to work something out with seek for you, but just can't find it yet.
This is how far I am yet :

#!/usr/bin/perl

use strict;

my $file = "...";

open(FH, "<$file");
seek(FH,2,2);
my $curpos = tell(FH); $_ = <FH>;
my $lastline = <FH>;
close(FH);

print "$lastline \n";
print "$curpos \n";
# --------------

As the seek brings me to the end of the file at the last character I cant print
the current line.
I will be looking further, there must be a beatifull way to do this.

Regs David
----------------
> 
> open (FILE, "yourfile.txt");
> my @FD = <FILE>;
> close (FILE);
> 
> my $lastline = $FD[$#FD]
> 
> Hope this help,
> Smiley Connie =)
> 
> 
> ----- Original Message ----- 
> From: "Karen Liew Ying Ping" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, June 24, 2002 6:05 PM
> Subject: Reading File
> 
> 
> Hi,
> 
> Let's say I'm opening a file.
> How do I read the last line of the file?
> is there any function in doing so?
> 
> Thanks.
> 
> 
> 
> 
> -- 
> 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