in reply to Print last line in a file

Using what you have already a simple modification does it - we just loop through the file setting each line to $last. At the end of the while loop $last will actually be the last line! This is momory efficient:

open(FH, "< $err_out") or die "can't open LOG FILE $!"; while (<FH>) { + $last = $_; } close FH; print "Last line was: ", $last; Alternatively you could just do this ad grab the whole file in an arra +y: open FH, $file or die $!; @file = <FH>; close FH; print "Last 4 lines, backwards: ", @file[-1,-2,-3,-4];

PS if you enclose your code in <code> </code> tags it will retain its formatting.

Hope this helps. cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print