Perl v5.28 has a few new features and several removals of old features that you shouldn’t have been using anyway (so I’m not going to mention them). Continue reading “Perl v5.28 new features”
Category: perl
Deprecation warnings now tell you when the features will disappear
Perl v5.28 will have better deprecation warnings. Most of this I picked up from the lightning talk that Abigail gave at The Perl Conference. Continue reading “Deprecation warnings now tell you when the features will disappear”
You must escape the left brace in a regex
Update: v5.30 brings this back. The exceptions to allow people to catch up should have already been fixed.
In v5.26 and later, you have to escape the left brace, {
, in Perl regular expressions. You probably never thought about this overworked character, but lots of other people have. This is an important change because it’s a fatal issue that may cause your modules and other tools (such as an old version of autoconf!) to stop working. But, we’ve also known about this for a bit, so if you are up-to-date, things may have already been fixed.
{
Continue reading “You must escape the left brace in a regex”
/xx means more meaningless whitespace (and that’s good)
The /xx
match operator flag lets you add insignificant horizontal whitespace to character classes. You’ll have to upgrade to v5.26 to use it though, but that release is right around the corner.
The /x
has been around since v5.10. That allows you to spread out the parts of your pattern and to add internal comments. This flag makes horizontal whitespace insignificant.
Continue reading “/xx means more meaningless whitespace (and that’s good)”
v5.26 removes dot from @INC
As of v5.26, the .
in @INC
is gone by default. When you compile perl, it bakes the default module search path (based on your configure settings) into the binary. These are the paths that perl searches without you adding to @INC
with command-line switches or environment variables, and the paths you see when you run perl -V:
Strip leading spaces from here-docs with v5.26
Perl v5.26 allows you to indent heredocs, that special multi-line string quoting mechanism. In v5.24 and earlier, the content of any here-doc included the entire line with any leading whitespace might be there. That meant you typed here-docs in a way the broke the indention of the block that contained them. Perl 6 envisioned a way that this could work and now Perl 5 has stolen some of that.
Continue reading “Strip leading spaces from here-docs with v5.26”
Perl v5.24 adds a line break word boundary
Perl v5.24 adds a linebreak word boundary, \b{lb}
, to go along the new word boundaries added in v5.22. This is part of Perl’s increasing conformance with the regular expression requirements in Unicode Technical Standard #18. The Unicode::LineBreak implements the same thing, although you have to do a lot more work. Continue reading “Perl v5.24 adds a line break word boundary”
Perl v5.22 adds fancy Unicode word boundaries
Perl v5.22’s regexes added four Unicode boundaries to go along with the vanilla “word” boundary, \b
, that you’ve been using for years. These new assertions aren’t going to match perfectly with your expectations of human languages (the holy grail of natural language processing), but they do okay-ish. Although these appear in v5.22.0, as a late edition to the language they were partially broken in the initial release. They were fixed for v5.22.1. Continue reading “Perl v5.22 adds fancy Unicode word boundaries”
Perl v5.26 new features
Perl v5.26 has lots of improvements and some big changes with module loading. This might be the most backward-incompatible version this decade! As with any new perl, try it before you commit to it. You don’t want to install it over your currently working perl to later find out something doesn’t work.
Lexical $_ and autoderef are gone in v5.24
Two features that I have previously discouraged are now gone from Perl. The lexical $_
and auto dereferencing.
The lexical $_
was a consequence of the way Perl wanted smart match to work. In a given-when
, instead of aliasing $_
like foreach
does, the block had an implicit my $_ = ...
. This interfered with the package version, as I wrote about in Use for() instead of given() and Perl v5.16 now sets proper magic on lexical $_. Continue reading “Lexical $_ and autoderef are gone in v5.24”