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?
In reply to user defined character properties by andal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |