DavidSzczesniak
12/8/2017 - 10:52 AM

Using Unicode

# start with the utf8 pragma
use utf8;

sub pound_to_yen {...} #  subroutine example

my $yen = pound_to_yen('1000pound'); 

# Using double-quoted strings, you can represent character encodings by using a Unicode escape sequence
my $escaped_thorn = "\x{00FE}"; # hex form of the character's Unicode number in the curly brackets

# Unicode characters that have names can be enabled with the charnames pragma and the \N{} escape syntax
use charnames ':full';
use Test::More tests => 1;

my $escaped_thorn = "\x{00FE}";
my $named_thorn = "\N{LATIN SMALL LETTER THORN}"; # named equivalent of the above example

is $escaped_thorn, $named_thorn, 
  'Thorn equivalence check';