andal has asked for the wisdom of the Perl Monks concerning the following question:
When reading perldoc perlunicode, I've stumbled over possibility to define my own character properties for matching. I decided to try this out as an interesting alternative to using ranges.
So here's the text from the pod.
Something to include, prefixed by "+": a built-in character property (prefixed by "utf8::") or a user-defined character property, to represent all the characters in that property; two hexadecimal code points for a range; or a single hexadecimal code point.
I've created the following test script
The execution of it gives the errormy $tst = "split-word another:one"; $tst =~ s/\p{IsSplitWord}+/**/g; print $tst,"\n"; sub IsMySep { return <<EOQ; 002D 003A 002F EOQ } sub IsSplitWord { return <<EOQ; 0041\t005A 0061\t007A +IsMySep EOQ }
SWASHNEW didn't return an HV ref at ./tester.pl line 3What am I doing wrong?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: user defined character properties
by Corion (Patriarch) on Oct 27, 2010 at 08:20 UTC | |
by andal (Hermit) on Oct 27, 2010 at 08:44 UTC | |
by JavaFan (Canon) on Oct 27, 2010 at 10:51 UTC | |
by andal (Hermit) on Oct 27, 2010 at 11:59 UTC |