Read a file character by character/UTF8: Difference between revisions

Content added Content deleted
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (Fix Perl 6 -> Raku in comments)
Line 895: Line 895:
=={{header|Raku}}==
=={{header|Raku}}==
(formerly Perl 6)
(formerly Perl 6)
Perl 6 has a built in method .getc to get a single character from an open file handle. File handles default to UTF-8, so they will handle multi-byte characters correctly.


Raku has a built in method .getc to get a single character from an open file handle. File handles default to UTF-8, so they will handle multi-byte characters correctly.
To read a single character at a time from the Standard Input terminal; $*IN in Perl 6:

To read a single character at a time from the Standard Input terminal; $*IN in Raku:
<lang perl6>.say while defined $_ = $*IN.getc;</lang>
<lang perl6>.say while defined $_ = $*IN.getc;</lang>