Skip to content

Instantly share code, notes, and snippets.

@zby
Created July 23, 2010 11:24
Show Gist options
  • Save zby/487312 to your computer and use it in GitHub Desktop.
Save zby/487312 to your computer and use it in GitHub Desktop.
use strict;
use Devel::Peek;
binmode(STDOUT,":utf8");
for my $letter ( "\x{0411}", 'A' ){
print "Letter $letter\n";
Dump $letter;
if( $letter =~ /p{Latin}/ ){
print "matched p{Latin}: $1\n";
}
if( $letter =~ /p{^Latin}/ ){
print "matched p{^Latin}: $1\n";
}
if( $letter =~ /P{Latin}/ ){
print "matched P{Latin}: $1\n";
}
if( $letter =~ /P{^Latin}/ ){
print "matched p{^Latin}: $1\n";
}
if( $letter =~ /p{Cyrillic}/ ){
print "matched p{Cyrillic}: $1\n";
}
if( $letter =~ /p{^Cyrillic}/ ){
print "matched p{^Cyrillic}: $1\n";
}
if( $letter =~ /P{Cyrillic}/ ){
print "matched P{Cyrillic}: $1\n";
}
if( $letter =~ /P{^Cyrillic}/ ){
print "matched p{^Cyrillic}: $1\n";
}
}
__OUTPUT__
Letter Б
SV = PV(0xe57268) at 0xe70f60
REFCNT = 2
FLAGS = (POK,READONLY,pPOK,UTF8)
PV = 0xe7ad00 "\320\221"\0 [UTF8 "\x{411}"]
CUR = 2
LEN = 8
Letter A
SV = PV(0xe57418) at 0xe70ea0
REFCNT = 2
FLAGS = (POK,READONLY,pPOK)
PV = 0xe829d0 "A"\0
CUR = 1
LEN = 8
__VERSION__
This is perl 5, version 12, subversion 1 (v5.12.1) built for x86_64-linux
@zby
Copy link
Author

zby commented Jul 23, 2010

Solved now: p{... should be \p{...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment