develooper Front page | perl.perl6.users | Postings from September 2019

Re: $*ARGFILES and MAIN

Thread Previous | Thread Next
From:
Marc Chantreux
Date:
September 23, 2019 19:51
Subject:
Re: $*ARGFILES and MAIN
Message ID:
20190923195122.GA24770@prometheus.u-strasbg.fr
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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About