The answer Laurent Roseenfeld gave you works for read and readchars as well. Save the following lines in a file and run it (try and change .read into .readchars too); it will output a series of 10-byte long Buf[uint8]s, until it reaches the end of file.
#!/usr/bin/env perl6 given $*PROGRAM-NAME.IO.open { while my $bytes = .read: 10 { $bytes.say; } } On Tue, Oct 9, 2018 at 10:17 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 10/9/18 1:02 AM, ToddAndMargo via perl6-users wrote: > > Hi All, > > > > When reading a text file > > https://docs.perl6.org/routine/lines > > seems pretty straight forward. > > > > Question: How do I tell when I when I have > > reached the EOF (End Of File)? > > > > Many thanks, > > -T > > Please expand the question to include `read` and `readchars`. > -- Fernando Santagata