my ($field1, $field2, $field3) = (undef, undef, undef); my $sth = $dbh->prepare('select * from table'); $sth->execute; if ($sth->rows > 0) { $sth->bind_columns(\($field1, $field2, $field3)); $sth->fetch; } $sth->finish; for ($field1, $field2, $field3) { $_ ||= '' }