my $rows = $sel->fetchall_arrayref(); # still prints the right number of refs print @$rows; foreach my $row (@$rows) { print join (",", @$row) }