-start-
>   "Ricardo Cumberbatch L." <[EMAIL PROTECTED]>
>at    02/15/2001 08:24 AM

>Hi every one I had to do a perl script but a need to know how in perl you
>do to read the last line in a file, I no to read in a file but how to 
read
>every time a need the last line in a file.

Probably the best methods for handling possibly large files would be...

my $line;
open(FH, "file.txt") or die $!;
$line = $_  while <FH>;
close FH;
print $line;

# or on Unix..
my $line = `tail -n 1 file.txt`;


Grant Hopwood.
Valero Energy Corp.
(210)370-2380
PGP Public Key: Ldap://certserver.pgp.com
-= Fail"ure: 'fA(&)l-y&r, noun, When your best just isn't good enough. =-
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to