Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: replacement for deprecated encoding pragma

by haj (Vicar)
on Jul 20, 2021 at 11:44 UTC ( [id://11135214]=note: print w/replies, xml ) Need Help??


in reply to Re^2: replacement for deprecated encoding pragma
in thread replacement for deprecated encoding pragma

It is has not been replaced by nothing. What has been taken away, without replacement, is the feature to write use encoding 'ISO-8859-5'; and then use cyrillic characters in that encoding in character literals of your source code. But you didn't do that, you declared UTF-8, and there is a replacement for that: There is use utf8; which is the equivalent of use encoding 'utf8';

Note that (precisely: Since Perl 5.8.2) neither of those affects how your program reads and writes text: They are used to declare that your source code is encoded as UTF-8. So it mostly affects string literals in your code, but not templates or anything else your program reads or prints to.

If you want to set a default encoding, have a look at open. If you write use open ':encoding(UTF-8)'; then every calls to open within the lexical scope of the open pragma will be UTF-8 encoded.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135214]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found