#!/usr/local/bin/perl $/ = ''; while (<>) { $* = 1; s/^-- ?$// if eof; s/^[-+]{2}\w+$// if eof; next unless split(/\n/); $max = 0; $* = 0; for (@_) { 1 while s/\t+/' 'x (length($&) * 8 - length($`) % 8)/e; $max = ($max > length) ? $max : length; } $edge = "+" . "-" x ($max+2) . "+\n"; print $edge; for (@_) { printf "| %-${max}s |\n", $_; } print $edge, "\n"; }