latin: pairwise loop through rows
[sheet.git] / latin.plp
index 529b334574d421c496842bef61a00da396238c60..1fda12c5fb40846fa8cc49b62f11fb0c1cf93dd9 100644 (file)
--- a/latin.plp
+++ b/latin.plp
@@ -46,14 +46,19 @@ and <a href="/unicode">common chars</a>.</p>
 <div>
 
 <:
+use List::Util qw( pairs );
+
 my @table = do 'writing-latn.inc.pl';
 if ($! or $@) {
        Alert("Table data not found", $@ || $!);
 }
 else {
        say '<table class="glyphs">';
-       print ref $_ ne 'ARRAY' ? "<tr><th>$_\n" : map {/^<td/ ? $_ : "\t<td>$_\n"} @$_
-               for @table;
+       for my $row (pairs @table) {
+               my ($title, $cells) = @{$row};
+               say '<tr><th>', $title;
+               print /^<td/ ? $_ : "\t<td>$_\n" for @{$cells};
+       }
        say "</table>\n";
 }