in reply to Re: Faster push and shift
in thread Faster push and shift

I don't think your solution is equivalent to the original program. Your idea is to stop reading the file as soon as @b "has enough elements", i.e. you are interested in the first set of occurances of "suitable elements" in the file.

The OP, however, throws out elements from @b (he is basically treating @b as a queue, where he pushes from one end and shifts from the other), so he is interested in the last set of occurances. That's why he has to process the whole file always.

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^3: Faster push and shift
by choroba (Cardinal) on Feb 16, 2012 at 14:18 UTC
    That's why use File::ReadBackwards;

      Ooops, I skipped this part. Great!!

      -- 
      Ronald Fischer <ynnor@mm.st>