my $sql="SELECT * FROM product"; my $sth = $dbh->prepare( $sql ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute() or die "Could not execute SQL statement:$sql \n" . $sth->errstr; my $rv = $sth->rows; my $count = 0; my $rowcache = []; # cache for batches of rows # while ( my $row = shift(@$rowcache) || shift(@{$rowcache=$sth->fetchall_arrayref(undef, 10000) || []}) ){ while ( my @row = $sth->fetchrow_array() ){ # $content[$count] = \@row; # $count++; $count = push(@content, \@row); print "count = $count\n"; }