Read a file character by character/UTF8: Difference between revisions
Read a file character by character/UTF8 (view source)
Revision as of 17:28, 21 March 2020
, 4 years agoFix Perl 6 -> Raku in comments
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
Thundergnat (talk | contribs) m (Fix Perl 6 -> Raku in comments) |
||
Line 895:
=={{header|Raku}}==
(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. ▼
▲
To read a single character at a time from the Standard Input terminal; $*IN in Perl 6:▼
<lang perl6>.say while defined $_ = $*IN.getc;</lang>
|