When Perl made regexes more Unicode aware, starting in v5.6, some of the character class definitions and match modifiers changed. What you expected to match \d, \s, or \w are more expanvise now (Know your character classes under different semantics). Most of us probably didn’t notice because the range of our inputs is limited.
Category Archives: 5.14
When Perl made regexes more Unicode aware, starting in v5.6, some of the character class definitions and match modifiers changed. What you expected to match \d, \s, or \w are more expanvise now (
Perl v5.14 gets a step closer to a saner way to declare classes with its new package NAME BLOCK syntax that lets you easily group everything that goes in a package.
[Update: Perl v5.24 removes this experimental feature, for the reasons I list, among others.] Perl 5.14 added an auto-dereferencing features to the hash and array operators, and I wrote about those in Use array references with the array operators. I’ve never particularly liked that feature, but I don’t have to like everything. Additionally, Perl 5.12 […]
Are you tired of adding the same modifiers to all of your regular expressions? For instance, if you might always add the /u modifier to turn on Unicode semantics on all of your patterns, including qr//, m//, and s///. Instead of remembering to do that to every pattern, the re that ships with Perl 5.14 […]
[This is a mid-week bonus item since it’s so short] In Perl 5.13.2, you got a non-destructive version of the substitution operator (Use the /r substitution flag to work on a copy). Instead of changing it’s target, the non-destructive version returns a new string that has the substitution. Perl 5.13.7 extends the /r to work […]
[Update: Perl v5.24 removes this experimental feature] There’s a significant change in syntax showing up in Perl 5.14. The array operators push, pop, shift, and unshift previously only worked on named arrays or dereferenced references. Now, thanks to David Golden, they’ll work on array references. Not only that, they’ll work on references that you’ve stored […]
[This is another bonus, mid-week item since it’s so short and probably mostly useless as a tweak to what you already do.] Perl 5.14 changes srand to return the seed that it used to start the pseudorandom number generator that gives you numbers through rand. There are plenty of interwebs that will explain the difference […]
Perl 5.14 changes how regular expression objects stringify. This might not seem like a big deal at first, but it exposes a certain sort of bug that you may have never considered. It even broke several modules on CPAN. If you previously tested for hard-coded stringifications of patterns, Perl 5.14 is probably going to break […]
Perl 5.14 gives you some new ways to represent characters so you can avoid some annoying and ambiguous interpolations. Not only that, the new syntax unifies the different ordinal representations so you can specify characters using the same syntax even if you want to use different bases. This feature was added in Perl 5.13.3, in […]