$sth=$dbh->prepare(qq{select id, quotient from ergebnis order by id}); $sth->execute(); my $array_ref=$sth->fetchall_arrayref(); foreach my $row (@$array_ref) { #split the row my ($id, $quotient) = @$row; print "$id\t$quotient\n"; }