What’s new: Experimental features

Learning Perl, Seventh Edition adds an appendix on Perl’s experimental features. This way, we can introduce such a feature in the chapters without explaining the dance of pragmas and proper versions each time. People who don’t want to use those features can easily skip over those bits in the main text.

With one or two mildly interesting experimental features, we would be content to leave out any mention of them. And, since we expect this edition to last for three years, we want to present currently experimental features we expect to be stable by then.

The most interesting new experimental feature, and the one we hope becomes stable soon, is subroutine signatures. Perhaps by adding this to the book it will magically work out. Although, we tried that with smart matching and we had to remove that chapter.

This syntax exceedingly pleases us in that it’s a bit quicker to denote what the subroutine expects, it sets default values, and it’s less ugly (perhaps the greatest benefit of any new feature). New Perlers should like the language even more when they can define a subroutine with something like this:

sub do_this_thing ( $first, $second = 'default', $ ) {

We also included the new bitwise feature that clears up the string-or-number wart that has plagued those operators. One of Perl’s great strengths is its easy conversion between the two, but almost all operators will do the same thing no matter the input. The numeric addition operator always does numeric addition. This isn’t true of the bitwise operators, at least until this experimental feature fixes that. As a former scientists and hobbyist binary format reverse engineered, this often ignore corner of Perl makes me happy.

Before we make it to the next edition, we expect some of these features to be stable. We hope that future-proofs the book at least a little.

Leave a Reply

Your email address will not be published. Required fields are marked *