Align columns: Difference between revisions
m
→{{header|Perl 6}}: Fix up bit rotted example
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Fix up bit rotted example) |
|||
Line 3,619:
=={{header|Perl 6}}==
{{works with|Rakudo|2015-12}}
<lang Perl 6>###to be called with perl6 columnaligner.pl <orientation>(left, center , right )
###with left as default
Line 3,659 ⟶ 3,660:
Or another way. To be called exactly as the first script.
<lang Perl 6>my @lines = slurp("example.txt").lines;
Line 3,665:
for @lines { for .split('$').kv { @widths[$^key] max= $^word.chars; } }
for @lines { say |.split('$').kv.map: { (align @widths[$^key], $^word) ~ " "; } }
sub align($column_width, $word, $aligment = @*ARGS[0]) {
|