my $dbh = DBI->connect( "dbi:xxx:xxx", "xxxx", 'xxxx'); my $sth = $dbh->prepare('SELECT title, url FROM fd_entries ORDER BY timestamp DESC LIMIT 200'); $sth->execute(); # create a callback subroutine to generate the data to be paged my $get_data_sub = sub { my ($offset, $rows) = @_; #my @return_array; my $return_array = $sth->fetchrow_array(); for (my $x = 0; $x < $rows; $x++) { push(@return_array, [ $data[$offset + $x]{title}, $data[$offset + $x]{url} ] ); } return \@return_array; } ;