Updates to Chapter 15, “Smart matching and given-when”

[This post notes differences between the fifth and sixth editions.]

The chapter on smart matching and given-when is the newest chapter, but also the one a bit out of date. Since we were writing the fifth edition right on the cusp of the release of Perl 5.10.0, we weren’t aware of all the problems that the new smart match feature had.

I did start to find problems, and I posted to perl6.language, perl5.porters and perlbug around the time we were turning in the book which hit the shelves in June 2008. It takes about four months to go from the end of writing to delivering the dead trees to the reader.

No one had an answer, and the next version of Perl changed quite a bit of the smart matching mechanism. For instance, see my p5p messages for [PATCH] perlsyn: equivalent code for HASH ~~ ARRAY and [perl #50538] when( @n && %n ) fails to smart match.