See. File::ReadBackwards for more info on the module and Performing a tail(1) in Perl (reading the last N lines of a file) for a good node on reading the last line of a file.use File::ReadBackwards; open(my $fh, "test") or die("ack - $!"); my $first = <$fh>; close $fh my $last = File::ReadBackwards->new("test")->readline;
_________
broquaint
In reply to Re: Capturing the first and last line of a file ?
by broquaint
in thread Capturing the first and last line of a file ?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |