Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Python 2.7.18, the last release of Python 2. Parent comment
# declare that the code itself is written in utf8 use utf8; my $ā = 'ā';
use feature 'unicode_strings';
use v5.12;
Really mostly what you have to do is declare the encodings of the file handles.
# change it for all files use open ':encoding(UTF-8)';
open my $fh, '<', 'example.txt'; binmode $fh, ':utf8';
---
Basically Perl just defaults to the old original ways. If you need a new feature which would break old code, you just declare that you need it.
Because of that, most code that was written for an earlier form of Perl still works on the latest version.
There are no comments on this comment yet.
Really mostly what you have to do is declare the encodings of the file handles.
To change it per file handle, you would use `binmode`. (Which was originally added to allow binary code to work on Windows.) (Declaring the encoding of an opened file is something you should do anyway.)---
Basically Perl just defaults to the old original ways. If you need a new feature which would break old code, you just declare that you need it.
Because of that, most code that was written for an earlier form of Perl still works on the latest version.