limiting rows returned by fetchall_arrayref ?



What's the right way to ask the following:

I'd like to use fetchall_arrayref, or equivalent to retrieve at most X
rows from my dataset. Later I'll return to get the next X rows and
continue looping until all rows of interest are retrieved.

I know that I can't hold the total return set so I'd like to retrieve
1000 rows at time.

.