use warnings; use 5.028; use experimental 'regex_sets'; use open qw/:std :utf8/; use charnames ':full'; my $PERL_IDENT_RE = qr/ (?[ ( \p{Word} & \p{XID_Start} ) + [_] ]) (?[ ( \p{Word} & \p{XID_Continue} ) ]) * /x; for my $c ( 0x2211, 0x03A3, 0x222B, 0x0283 ) { printf "%s U+%04X %s %s\n", chr($c), $c, charnames::viacode($c), chr($c) =~ /\A$PERL_IDENT_RE\z/ ? "matches" : "doesn't match"; }