my $aref = $sth->fetchall_arrayref(); foreach (@$aref) { #now $_ is ref to an array holding one result row for (my $i = 0; $i < @$_; $i++) { print "$i: $_->[$i]\t"; } print "\n"; }