use warnings; use strict; use CGI qw/ escapeHTML /; # this is the data you'd normally get from the DB my @cols = ( "foo", "bar", "q\">\n\n}; for my $col (@cols) { print qq{\t\n}; }; print qq{\n\n}; __END__ Output: