OUTER: while (my $row = $sth->fetchrow_arrayref) { INNER: foreach my $column (@$row) { next OUTER if($column eq undef); } print @$row, "\n"; }