Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Do you know where your variables are?
 
PerlMonks  

Re: Regexp \N{name}

by cjb (Friar)
on Feb 03, 2011 at 10:38 UTC ( #885960=note: print w/ replies, xml ) Need Help??


in reply to Re: Regexp \N{name} (use of \e)

#!/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 example


Comment on Re: Regexp \N{name}
Download Code
use of \e
by gautam_9jan on Feb 03, 2011 at 19:14 UTC
    Thank you for your reply please can you tell me why you used binmode STDOUT, ":utf8"; please reply me as soon as possible.........
      Check out perlunicode, <STDOUT> is just a file handle so a belts and braces approach to ensure that it was displaying the unicode characters correctly.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://885960]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2014-04-23 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (541 votes), past polls