# and in the perl just do my @cols = $sth->fetchrow_array; my $row = join "\n", '', (map { " $_" } @cols) , "\n"; # now just insert $row on block