Take a look at File::ReadBackwards:
#!/usr/bin/perl use strict; use warnings; use feature qw/say/; use File::ReadBackwards; tie *BW, 'File::ReadBackwards', '/path/to/your_file' or die "Cannot re +ad file: $!"; chomp(my $name = <BW>); chomp(my $id = <BW>); say "Name: $name"; say "ID: $id";
Hope this helps!
In reply to Re: How can I grab the last 2 lines of a file?
by AppleFritter
in thread How can I grab the last 2 lines of a file?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |