You can create your own $*ARGFILES.
sub MAIN ( +@ARGS ){
my $*ARGFILES = IO::ArgFiles.new( @ARGS || $*IN );
.say for lines;
}
Note that IO::ArgFiles is now only just a subclass of IO::CatHandle.
On Mon, Sep 23, 2019 at 2:51 PM Marc Chantreux <[email protected]> wrote:
> hello,
>
> > > multi sub MAIN ( :$c ) { say [+] lines>>.chars }
> > Isn't that just `slurp.chars` ?
>
> correct :)
>
> > > multi sub MAIN ( :$w ) { say [+] lines.map: +*.words }
> > Isn't that just `+words` ?
>
> Aren't you awesome ? At least you're right: the doc says:
>
> multi sub words
> ( IO::Handle:D $fh = $*ARGFILES
> , $limit = Inf
> , :$close --> Seq:D)
>
> and it work like a charm.
>
> > You should **never** use >>. on anything that you expect the order of
> > execution to be the order of the input. `>>.` allows the compiler to
> > execute the code over multiple threads, so the `say` could be shown
> > out of order.
>
> wow ... thanks for pointing this. still can't mix MAIN and ARGFILES but
> learned. thank you very much.
>
> regards
> marc
>