in reply to Print last line in a file
You can also jump down to the end of the file:
That way, even if it's a huge file you only grab the last 200 bytes. Though, this will only get part of the last line if the line is longer than 200 bytes. One could check for a return and if not present grab further back.open(FILE, "< $err_out") or die $!; seek(FILE, -200, 2); my @lastones = <FILE>; print $lastones[-1];
|
|---|