# $dbh has already been ->connect()ed my $sth = $dbh->prepare( "SELECT name, adres, woonplaats FROM personen" ); $sth ->execute(); # Get all the results rows and store the array reference my $array_ref = $sth->fetchall_arrayref(); # For each row in the result set, print it out. foreach my $row(@$array_ref) { my( $name, $adres, $woonplaats) = @$row; print "$name t $adres t $woonplaats"; }