Perl: Allowed Char in Identifiers (variable name, function name)
Perl Identifiers Allow Unicode Letter Characters
Identifier names can have Unicode: Letter Character
use utf8; use strict; # variable with Unicode char my $æ = 4; print "$æ\n"; # function with Unicode char sub fæ { return 2;} print fæ();
Identifier cannot have emoji or arbitrary unicode char
# perl v5.32.1 use strict; use utf8; # identifier cannot be emoji my $ð = 3; # error # Unrecognized character \x{1f602}
# perl v5.32.1 use strict; use utf8; # identifier cannot be arbitrary unicode char my $⥠= 3; # error # Unrecognized character \x{2665}
The exact rule is complicated. But basically, if the unicode is considered a Unicode Letter Character , then, it's ok. Heart ⥠(U+2665: BLACK HEART SUIT) and emoji are not letters.