Turn off indirect object notation

Perl v5.32 adds a way to turn off a Perl feature that you shouldn’t use anyway. You can still use this feature, but now there’s a way to take it away from you. And, with the recent Perl 7 announcement, we see why. Eventually Perl wants to get rid of indirect object notation (and I explain that more in Preparing for Perl 7.

Continue reading “Turn off indirect object notation”

Don’t use auto-dereferencing with each or keys

[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 expanded the job of keys and values to also work on arrays. Continue reading “Don’t use auto-dereferencing with each or keys”

Count the number of times a character occurs in a string

This Item isn’t really about counting characters in a string, but we thought we’d expand on an Item in the original Effective Perl blog that Joseph set up to support the first edition of Effective Perl Programming. He had an Item titled “Counting the Number of Times a Character Occurs in a String”. We won’t reproduce it here, so you should read his version too. Continue reading “Count the number of times a character occurs in a string”

Make exclusive flip-flop operators

In Respect the global state of the flip flop operator, you saw some examples of the .. scalar operator. The flip-flop operator returns false until its lefthand side is true. Once the lefthand side is true, the flip-flop operator returns true until its righthand side is true. Once the righthand side is true, the flip flop operator returns false: Continue reading “Make exclusive flip-flop operators”