#!/usr/bin/perl use strict; use warnings; sub make_html { my $array= shift @_; my $rows= $#$array; my $cols= $#{$array->[0]}; my @html; my @last= @{ $array->[$rows] }; my @span= (1) x (1+$cols); push @html, "\n"; foreach my $row ( reverse [], @$array[0..$rows-1] ) { push @html, "\n"; foreach my $col ( reverse 0..$cols ) { if( @$row && $last[$col] eq $row->[$col] ) { $span[$col]++; } else { my $span= 1==$span[$col] ? "" : " rowspan='$span[$col]'"; push @html, "