Use Unicode 10 in Perl v5.28

Perl v5.28 updates to Unicode 10. There are 8,518 new characters, 7,473 which are in the CJK extension. There are 56 new emojis. And, the Bitcoin symbol, ₿. It adds a T. rex, 🦖, but we’re still waiting for a raptor. To Perl they are just characters like any other so you don’t need anything new to deal with them.

You can find the count of the new characters as you saw in Find the new emojis in Perl’s Unicode support but with an updated Unicode version number:

use v5.28;
use utf8;
use strict;
use warnings;

my $count = 0;
foreach ( 0 .. 0x10FFFF ) {
	my $char = chr;
	next if $char =~ /\p{Present_In: 9.0}/;
	next if $char =~ /\p{Unassigned}/;
	$count++;
	}
say "There are $count new chars";

There’s the new count of characters:

There are 8518 new chars

The addition of the Bitcoin symbol enhances your Bitcoin accounting software:

printf "I lost 100 ₿, which is %.2f dollars\n", rand(time);

The exciting additions are the are the emojis (I guess). The Mojo program from the previous post needs a slight update for the URL and selectors:

use charnames qw();

use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;

my $url = 'https://blog.emojipedia.org/whats-new-in-unicode-10/';
my $tx = $ua->get( $url );

die "That didn't work!\n" unless $tx->success;

say $tx->result
	->dom
	->find( 'ul:not( [class] ) li a' )
	->map( 'text' )
	->map( sub {
		my $c = substr $_, 0, 1;
		ord($c) > 0x1F000
			?
		[ $c, ord($c), charnames::viacode( ord($c) ) ]
			:
			()
		})
	->sort( sub { $a->[1] <=> $b->[1] } )
	->map( sub {
		sprintf '%s (U+%05X) %s', $_->@*
		} )
	->join( "\n" );

Unicode 9 got a spoon, 🥄, but Unicode 10 does it one better with a spoon and bowl, 🥣. Too bad it has a cup with a straw,🥤:

🛷 (U+1F6F7) SLED
🛸 (U+1F6F8) FLYING SAUCER
🤟 (U+1F91F) I LOVE YOU HAND SIGN
🤨 (U+1F928) FACE WITH ONE EYEBROW RAISED
🤩 (U+1F929) GRINNING FACE WITH STAR EYES
🤪 (U+1F92A) GRINNING FACE WITH ONE LARGE AND ONE SMALL EYE
🤫 (U+1F92B) FACE WITH FINGER COVERING CLOSED LIPS
🤬 (U+1F92C) SERIOUS FACE WITH SYMBOLS COVERING MOUTH
🤭 (U+1F92D) SMILING FACE WITH SMILING EYES AND HAND COVERING MOUTH
🤮 (U+1F92E) FACE WITH OPEN MOUTH VOMITING
🤯 (U+1F92F) SHOCKED FACE WITH EXPLODING HEAD
🤱 (U+1F931) BREAST-FEEDING
🤲 (U+1F932) PALMS UP TOGETHER
🥌 (U+1F94C) CURLING STONE
🥟 (U+1F95F) DUMPLING
🥠 (U+1F960) FORTUNE COOKIE
🥡 (U+1F961) TAKEOUT BOX
🥢 (U+1F962) CHOPSTICKS
🥣 (U+1F963) BOWL WITH SPOON
🥤 (U+1F964) CUP WITH STRAW
🥥 (U+1F965) COCONUT
🥦 (U+1F966) BROCCOLI
🥧 (U+1F967) PIE
🥨 (U+1F968) PRETZEL
🥩 (U+1F969) CUT OF MEAT
🥪 (U+1F96A) SANDWICH
🥫 (U+1F96B) CANNED FOOD
🦒 (U+1F992) GIRAFFE FACE
🦓 (U+1F993) ZEBRA FACE
🦔 (U+1F994) HEDGEHOG
🦕 (U+1F995) SAUROPOD
🦖 (U+1F996) T-REX
🦗 (U+1F997) CRICKET
🧐 (U+1F9D0) FACE WITH MONOCLE
🧑 (U+1F9D1) ADULT
🧒 (U+1F9D2) CHILD
🧓 (U+1F9D3) OLDER ADULT
🧔 (U+1F9D4) BEARDED PERSON
🧕 (U+1F9D5) PERSON WITH HEADSCARF
🧖 (U+1F9D6) PERSON IN STEAMY ROOM
🧗 (U+1F9D7) PERSON CLIMBING
🧘 (U+1F9D8) PERSON IN LOTUS POSITION
🧙 (U+1F9D9) MAGE
🧚 (U+1F9DA) FAIRY
🧛 (U+1F9DB) VAMPIRE
🧜 (U+1F9DC) MERPERSON
🧝 (U+1F9DD) ELF
🧞 (U+1F9DE) GENIE
🧟 (U+1F9DF) ZOMBIE
🧠 (U+1F9E0) BRAIN
🧡 (U+1F9E1) ORANGE HEART
🧢 (U+1F9E2) BILLED CAP
🧣 (U+1F9E3) SCARF
🧤 (U+1F9E4) GLOVES
🧥 (U+1F9E5) COAT
🧦 (U+1F9E6) SOCKS
Leave a comment

0 Comments.

Leave a Reply


[ Ctrl + Enter ]