> I have a file that has roughly 100 lines.  I want to use the seek function 
> to seek to the end of the file and read the last line into a var and pring 
> it out.  Can someone help?

That's not what the seek function does.  The seek function finds a
specific byte position in a file, and you're working on a line-by-line
basis.

If you want the last line, you have to read thru the file and hold on to
the last line:

open( IN, $filename ) or die "Couldn't open $filename: $!";
my $last;
while ( <IN> ) {
    $last = $_;
    }
print "Last line is:\n$last\";


Also, if you're using unix, you can simply say

    tail -1 filename

xoxo,
Andy

-- 
'Andy Lester        [EMAIL PROTECTED]
 Programmer/author  petdance.com
 Daddy              parsley.org/quinn   Jk'=~/.+/s;print((split//,$&)
                            [unpack'C*',"n2]3%+>\"34.'%&.'^%4+!o.'"])

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

Reply via email to