#!/opt/perl/bin/perl use strict; use warnings; use charnames ':full'; binmode STDOUT, ":utf8"; my $string = ':)'; print "$string becomes: "; $string =~ s/:\)/\N{WHITE SMILING FACE}/; print "$string\n$string becomes: "; $string =~ s/\N{WHITE SMILING FACE}/\N{BLACK SMILING FACE}/; print "$string\n$string becomes: "; $string =~s/\N{BLACK SMILING FACE}/:\)/; print "$string\n";
That should cover most uses of \N{CHARNAME}.
charnames and perlre are the best references.
Update: added #! to exampleIn reply to Re: Regexp \N{name}
by cjb
in thread Re: Regexp \N{name} (use of \e)
by gautam_9jan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |