encoding
Although Perl 5.6.0 introduced Unicode support, it was
not complete until Perl 5.8. With encoding.pm, you can write any Perl script
with whatever encoding type you want. If you’re a show off and worship
anime movies, and want to write your Perl program in Kanji, use
encoding
, and be our guest:
# Cute example, slightly modified from the encoding.pm doc #!/usr/local/bin/perl -w use encoding 'euc-jp'; # Note that we support only one encoding my $book = 'Camel'; my $Rakuda = "\xF1\xD1\xF1\xCC"; # Camel in Kanji $book =~ s/\bCamel\b/$Rakuda/;
Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.