How to print last line of file?
The Perl cookbook uses this method:
@lines = <FILE>;
$lastline = pop @lines
However the above method requires the file to be loaded completely into an array(memory) and is not suitable for large files.
Tie::File module cannot also be used here since I am using version 5.6 now.
Is there any other option to read the last line without the memory hog.
The Perl cookbook uses this method:
@lines = <FILE>;
$lastline = pop @lines
However the above method requires the file to be loaded completely into an array(memory) and is not suitable for large files.
Tie::File module cannot also be used here since I am using version 5.6 now.
Is there any other option to read the last line without the memory hog.