Book HomeJava and XSLTSearch this book

8.62. 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/;


Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.