Align columns: Difference between revisions

m
→‎{{header|Perl 6}}: Fix up bit rotted example
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.
{{broken|Perl 6}} ''Note: no error message, seems to work, but prints every line in parentheses.''
 
<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]) {
10,333

edits