http://www.perlmonks.org?node_id=11108477


in reply to Printing a UTF8 code

print FO "\x{00b9}"; # Outputs a strange character (the code for 00b9 is a superscript 1}

This works fine for me on Perl v5.20.3:

$ cat uniprint.pl 
#!/usr/bin/env perl 
use strict;
use warnings;

open my $out, '>:utf8', 'test.txt';
print $out "Hello\x{00b9}\n";
close $out;
$ ./uniprint.pl 
$ cat test.txt
Hello¹
$ hexdump test.txt
0000000 6548 6c6c c26f 0ab9                    
0000008
$

If you get different output from the hexdump, that would be informative to see. If the hexdump is the same, but the cat output doesn't match then your terminal or locale is probably to blame.