while (my $row = $sth->fetchrow_hashref) { print "The data in this_col is $row->{'this_col'}\n"; push(@rows,$row) # array of hashrefs or the whole table in a data structure }