in reply to last $n lines that match a criteria

An alternative to File::ReadBackwards would be the tac(1) command:

NAME
       tac - concatenate and print files in reverse

For example:

open(ELIF,"tac file.foo |") or die "Couldn't tac file: $!\n"; while (<ELIF>) { push @lines,$_ if /criteria/; last if @lines > $n; }