in reply to How to format cgi output?

If you are outputing to a browser then as tachyon pointed out the multiple white space is going to get eaten during rendering. You would be better off using the intrinsic HTML methods of CGI.

One such implementation looks something like this:

use CGI qw(:all); print header; print start_html; print "<table>\n"; # yuck... I hate this... foreach my $row(@sorted_data){ # Don't know where @sorted data came fr +om... print tr(map { td($_) } split(/|/,$row) ); } print "</table>"; # end yuck print end_html;

DISCLAIMER: this code is very untested and the author was very tired when he wrote it.
Hopefully there is enough there to at least give you an idea of how to proceed. You can sort out the rest I'm sure.