Hi Steve,
if you have enough RAM you could use $stm -> fetchall_arrayref
to get all the rows at one shot and then print the first ten ones.
But I think that's not the best idea.
I would use two SQL statements:
(1) "select count(*) from table where ..."
(2) "select top 10 * from table where ..."
If it is Oracle, you can do it with a single query.
Say you have a query of the form
select col1,...,coln from table1,...,tablem where STUFF
And you want the total count and also the first k rows.
Transform it to
select * from (
select col1,...,coln,