Perl makes it very convenient to get some symbol.
$ perl -CO -E 'say "\N{FAMILY}"'
👪
Is there a way to evaluate the symbol with "\N{}"
via interpolation? Something similar to:
perl -CO -E 'my $what = "FAMILY"; say "\N{$what}"'
(which does not work, but gives you the flavour).
Besides feasibility, is there any drawback or possible threat in such evaluation? E.g. say the $what
string is user-defined, I would never eval $what
. Would I \N{$what}
safely?
After getting the answers, I noticed how this information clearly stated in perlunicook
. Sorry for the lack of RTFM. I guess this is a good thing to have on stackoverflow anyway.
Use the vianame
function from charnames:
perl -CO -Mcharnames=:full -wE 'say chr charnames::vianame("PILE OF POO")'
💩
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With