my $sth = $dbh->prepare($sql); $sth->execute; $sth->bind_columns(\my ($col1, $col2 ... $coln)); my $count = 0; while ($sth->fetch) { [$col1 .. $coln will be populated with the values in that row] last if ++$count == 10; }