in reply to Reading the contents of a file from the bottom up
There's an API for that... File::ReadBackwards. I've never used it myself, but it appears to do what the documentation states.
Using a file called test.txt located in the same directory as the script itself which looks like this:
f e d c b a
...and this example script:
use warnings; use strict; use File::ReadBackwards; my $file = 'test.txt'; my $fh = File::ReadBackwards->new($file) or die "can't read the damned '$file' file!: $!"; until ($fh->eof) { print $fh->readline; }
...I get this output:
a b c d e f
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading the contents of a file from the bottom up
by perlancar (Hermit) on Nov 26, 2019 at 01:05 UTC |