Surprising output for the descending range ’01’..’-1′

[This is fixed in Perl v5.32]

The range operator has some interesting features to do more numbers, and one of them looks like it has some unintended special cases.

A couple of months ago, Hauke D reported some strange behavior with the range operator. Some of this is likely to be clarified in the v5.30 documentation but the odd cases remain. One part of this is useful and the others are probably surprising. Don’t depend on this feature for anything that’s important. Even though it acts like this, the undesigned feature may disappear.

Continue reading “Surprising output for the descending range ’01’..’-1′”

Updates to Chapter 3, “Lists and Arrays”

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

I went into this chapter thinking that it would be fairly easy: just fix up any possible typos or grammar problems, then move on. However, I was reading through Appendix B and noticed that in previous editions that we had ignored splice. We mention it all the way at the end of the book, but it almost takes as much space to say that we aren’t going to cover to say that we will. So, I move it out of Appendix B and into Chapter 3.

You would think that this chapter would be a natural to pull in things like List::Utils, but we actually save that for later. We make some Perl-pure versions of max in the “Subroutines” chapter, then later in the “Perl Modules” chapter we can abandon the examples we used to illustrate the Perl concepts so the reader can use List::Utils.