Hi, On 11/28/2015 05:49 PM, Marc Chantreux wrote: > hello, > > i would like to write a better version of the unix `column` with some > options like 'preserve separator' so i started to write it down. > > sub padded-cols ($sep,@sheet) { > my $fmt = > join $sep, > @sheet[0].keys.map: > -> $col { "\%-{ [max] @sheet[*;$col].map: *.chars }s" }; > @sheet.map: {$fmt.sprintf(|$_)} > } > > my $sep = @*ARGS.shift; > .say for padded-cols $sep, $*ARGFILES.lines.map: (*.split($sep)).eager; > > now i would like to add options like -mean -max 1:25 and it would be > nice to write a MAIN function to delegate borring stuff to perl6. > > i googled, tried to read the doc and grep in roast but i found no way to > do it. any idea to help me. so thanks thanks for reading and helping.
Since $*ARGFILES (the thing behind lines() for example) uses @*ARGS to determine what files to open, you can say sub MAIN(*@*ARGS, Bool :$mean) { ... } Cheers, Moritz