Perl - letter letters

Using Perl, I try to execute lowercase words with accents and special characters with lc(), but I cannot.

For instance:

É UM MAÇO

returns

É um maÇo

+5
source share
3 answers
-bash$ perl -we 'use utf8; binmode STDOUT, ":utf8"; print lc "É UM MAÇO"'
é um maço

utf8indicates that your program text is unicode. binmodeprovides the correct output of wide characters.

You can also use Encode;see docs .

+8
source

Try to add

use locale;

into your script. He must perform various functions, including lc, with emphasis. Full testing script:

use strict; use warnings;
use locale;
use utf8;

print lc('É UM MAÇO');    # gives "é um maço"
+1
source

All Articles