If you want to read you lines in groups of 3 then you want batch :

for @x.lines.batch(3) -> @b

If you just want the third line and throw away the first I'd probably do a
tail on that.

for @x.lines.batch(3).map( *.tail ) -> $l

Note you need to map the tail on each batch of three not slap it on the end.


On Sat, 23 Nov 2019, 06:00 ToddAndMargo via perl6-users, <
perl6-us...@perl.org> wrote:

> Hi All,
>
> In a "for" loop, what is the syntax for "by 3"?
>
>      for @x.lines by 3
>
> In other words, every third line.
>
> Many thanks,
> -T
>

Reply via email to