May 2019 Archives

Stupid Unicode Trick: Noncharacters

Perl RT 133292 is a request to expose the internal perl subroutine that does string interpolation, so that one does not need to figure out how to double-quote a string (escaping where necessary) when feeding it to eval() as a quick-and-dirty templating system.

In fact, there is no such subroutine (the parser makes an interpolation into a concatenation), and anyway why not just use sprintf()…

Wildcard Unicode Property Values

In addition to Native Variable-Length Lookbehind, Perl 5.29.9 (sic) includes another Regexp enhancement: wildcard Unicode property values. (And yes, this blog post sat around in draft form for over a month.)

Despite its name, the implementation is in terms of regular expressions rather than traditional wildcards. An example may be better than an explanation here: instead of writing /[\p{Script=Latin}\p{Script=Greek}]/, the new feature allows you to write …

About Tom Wyant

user-pic I blog about Perl.