Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

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


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial