> On Jul 28, 2019, at 6:20 PM, Joseph Brenner <doom...@gmail.com> wrote:
> 
> I was just wondering if there's some direct analog in perl6 to the
> perl5 construct:
> 
>  while(<>){ ... }
> 
> If I'm planning on passing a filename on the command-line, I can just
> get it out of $*ARGFILES easily enough, but what if I also wanted it
> to work on lines passed in via standard input?


`lines` , as a sub instead of a method, and no arguments.

See: https://docs.perl6.org/routine/lines#(Cool)_routine_lines
        Without any arguments, sub lines operates on $*ARGFILES, which defaults 
to $*IN in the absence of any filenames.

For example:
        perl6 -e 'say .join("\t") for lines().rotor(4);' path/to/file.txt

Hmmm. I would expect that to be in the Perl 5 to Perl 6 Migration Guides, but I 
do not see it there.

— 
Hope this helps,
Bruce Gray (Util of PerlMonks)

Reply via email to