The eof method of the IO::Handle class returns True if you exhausted the
contents of the handle, but you generally don't need to use that, since
something like:

for 'input.txt'.IO.lines -> $line {
    # Do something with $line
}

will gracefully handle ends of files for you without you having to do
anything special.



Le mar. 9 oct. 2018 à 10:03, ToddAndMargo via perl6-users <
perl6-users@perl.org> a écrit :

> 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
>

Reply via email to