Align columns: Difference between revisions

m
Line 1,074:
 
sub columns {
my @lines = map {[split /\$/]} => split /\n/ => shift;
my ($pos) = map {/center/ or /right/ * 2} @_;
local $_ = shift;
for my $col (0 .. max map {$#$_} @lines) {
my $max = max my @widths = map {length $lines[$_][$col]} 0 .. $#lines;
for my $row (0 .. $#lines) {
my $pad@cell = map {' ' x $_, ' ' x ($_ + 0.5)} ($max - $widths[$row]) / 2;
splice @cell, $pos, 0, $lines[$row][$col] = join '' =>;
($lines[$row][$col], '= ' x $pad,join ' ' x ($pad +=> 0.5))@cell;
[ /center/ ? (1,0,2) : /right/ ? (1,2,0) : (0,1,2) ]
}
}
Line 1,096 ⟶ 1,095:
justified,$right$justified,$or$center$justified$within$its$column.
END
 
</lang>