The "linux only" comment is obsolete in your updated version. It can still do with some cleaning up. Note this will still
fail if the last X lines of the file are larger than 2*200*X bytes, so you cannot compare it against the other solutions as it doesn't do the same thing.
die "Usage: $0 file numlines\n" unless @ARGV == 2;
my ($filename, $numlines) = @ARGV;
# open or die first so that we don't stat a file we don't know exists
open my $fh, "<", $filename or die "Couldn't open $filename: $!";
my $chunksize = 2 * 200 * $numlines;
my $filesize = -s $fh;
$chunksize = $filesize if $filesize < $chunksize;
# why seek twice?
seek $fh, -$chunksize, 2;
my @tail = <$fh>;
splice @tail, 0, @tail - $numlines;
$ perl -le'print "a"x500 for 1..10' > t.dat
$ tailz t.dat 5 | wc -l
You need a loop.
Makeshifts last the longest.