Align columns: Difference between revisions

Content added Content deleted
Line 1,078: Line 1,078:
for my $col (0 .. max map $#$_ => @lines) {
for my $col (0 .. max map $#$_ => @lines) {
my $max = max my @widths = map length $lines[$_][$col] => 0 .. $#lines;
my $max = max my @widths = map length $lines[$_][$col] => 0 .. $#lines;
for $row (0 .. $#lines) {
for my $row (0 .. $#lines) {
my $pad = ($max - $widths[$row]) / 2;
my $pad = ($max - $widths[$row]) / 2;
$lines[$row][$col] = join '' =>
$lines[$row][$col] = join '' =>