1. Perl
  2. Character code

Representing square meters (m2) in Unicode

If you're wondering how to express a small 2 when displaying square meters (m2), find a solution. All I had to do was express it in Unicode code points.

my $menseki = "100m\x{00B2}"; # 100 square meters

The code point that corresponds to the small 2 is 00B2 .

This is an decoded string, so you need to encode it in UTF-8 when you actually output it. Also, in the source code, let's "use utf8 " so that all characters are decoded strings.

print encode('UTF-8', $menseki);

After all, I thought that Perl that supports Unicode would be useful in such cases.

List of superscripts and subscripts

It seems that these are called superscripts. I've bookmarked a list of superscripts and subscripts, so I'll link to them.

Related Informatrion