csc,tech,base
csc,comp,acm
csc,mous,base
new,this,that
other,some,sing
other,some,sels
####
use SuperSplit;
use HTML::Table;
$data = supersplit_open( ',', 'table.txt');
####
@firstcol = map { $$_[0] } @$data;
@numbers = (1) x scalar(@firstcol); # init to (1,1,1,...)
for ($i = $#firstcol; $i > 0; $i--) {
if ($firstcol[$i] eq $firstcol[$i-1]) {
$numbers[$i-1] = $numbers[$i]+1;
$numbers[$i] = 0;
}
}
####
$table = new HTML::Table;
$table -> setBorder(2);
foreach $row (@$data) {
$table->addRow( @$row );
}
# $table->print;
####
foreach $rowno (0..$#firstcol) {
if ($numbers[$rowno]) {
$table->setCellRowSpan($rowno+1, 1, $numbers[$rowno]);
$table->setRowVAlign($rowno+1, "TOP")
};
}
$table->print;