On Sat, Nov 28, 2015 at 06:57:11PM +0100, Moritz Lenz wrote:
> sub MAIN(*@*ARGS, Bool :$mean) { ... }

damn it! i was so close! it will take me some time to understand that
the positions of the parameters are completely revisited.

so i mixed your answer and some interesting notes on lisibility by
cognominal and finally get the following code. 

thanks a lot, perl6 hackers! 

#! env perl6

sub padded-cols ($sep,@sheet) {
    sub record-fmt( $col ) { "\%-{ [max] @sheet[*;$col].map: *.chars }s" };
    my $fmt = @sheet[0].keys.map(&record-fmt).join: $sep;
    @sheet.map: {$fmt.sprintf(|$_)}

sub MAIN (*@*ARGS,:$t) {
    .say for padded-cols $t, $*ARGFILES.lines.map: (*.split($t)).eager;

Marc Chantreux (eiro on github and freenode)
"Don't believe everything you read on the Internet"
    -- Abraham Lincoln

Reply via email to