Align columns: Difference between revisions
Content added Content deleted
Line 1,074: | Line 1,074: | ||
sub columns { |
sub columns { |
||
my @lines = map [split /\$/] |
my @lines = map {[split /\$/]} split /\n/ => shift; |
||
local $_ = shift; |
local $_ = shift; |
||
for my $col (0 .. max map $#$_ |
for my $col (0 .. max map {$#$_} @lines) { |
||
my $max = max my @widths = map length $lines[$_][$col] |
my $max = max my @widths = map {length $lines[$_][$col]} 0 .. $#lines; |
||
for my $row (0 .. $#lines) { |
for my $row (0 .. $#lines) { |
||
my $pad = ($max - $widths[$row]) / 2; |
my $pad = ($max - $widths[$row]) / 2; |