in reply to Problem with SEEK to go back/forward a few lines.
Rather than doing the buffering and what not yourself it might be easier to use Tie::File instead.