push @rows, $_ for $ratings->fetchrow_arrayref(); # @rows now contains references to rows. # You access rows and colums using: my $value=$rows[1]->[1]; # This would fetch the 2nd column of the 2nd row