in reply to Re: last $n lines that match a criteria
in thread last $n lines that match a criteria

...it probably isn't terribly inefficient to use it in this way

But it *is* inefficient to read *every* line in the file, test *every* line against the regex, and push *every* matching line onto the array and shift all but $keep matching lines back off the array. File::ReadBackwards was designed for this kind of problem.

  • Comment on Re: Re: last $n lines that match a criteria