#code could look like this (untested): my $aref = $sth->fetchall_arrayref(); foreach my($cptanswer, $insid, $preauth, $updated)(@$aref) { print "\t$cptanswer\t$insid\t$preauth\t$updated\n"; }