#First, set a bunch of semi-constants (apologies to those offended by the lack of conventions here). $tdo = ""; $tdc = "<\/td>"; $tblo = ""; $hro = ""; $rc = "<\/tr>"; $ro = ""; $htd = "
"; $htdc = "<\/font><\/b>".$tdc; ## Now the actual working code $time=0; $Response->write($tblo); ## Write table (works) $filename = $Server->MapPath('./data/test.dat'); ## map file open(fileREAD, $filename); #open file (works) while ($line = ){ $rtype = ""; @array = split "\t", $line; $rtype = pop @array; $time ++; $Response->write("
line = ".$line."&".$rtype."&".$time."<\/td><\/tr>"); ## t-shoot #$Response->write("rtype = ".$rtype); if ($rtype = "header "){ $Response->write($hro); foreach (@array){ #$Response->write("
line = ".$line."&".$rtype."&".$time."<\/td><\/tr>"); $Response->write($htd.$_.$rtype.$htdc); #$Response->write("
line = ".$line."&".$rtype."&".$time."<\/td><\/tr>"); } } elsif ($rtype = "row "){ $Response->write($ro); foreach (@array){ $Response->write($td.$_.$tdc); } } $Response->write($rc);