That Darn Single Quote

The more I think about the “single-quote as alternate package separator” thing I mentioned in my last post, the more it bothers me. The problem I ran into, trying to print "$user's crontab is missing!\n", generated an “uninitialized value” warning. It did NOT get picked up by strict mode—which was on—because packaged-qualified variables are always OK.

This strikes me as a source of hard-to-find and relatively easy-to-generate bugs. Given all the other stuff that has been deprecated out of Perl over the years, I am surprised this hasn’t been tagged for deprecation. Especially given that, according to a comment from preaction, the single-quote as a package separator was considered archaic as of Perl 5.6.


I will admit I get a little snarky on this, but this is where Perl5's King Backcompat wins out over providing sane defaults for newcomers. Yes, there is value in being a super stable language but when we can never make the defaults more aligned with beginner expectations we can't be surprised that we only seem to have legacy users.

Leave a comment

About morandimus

user-pic My real name is Jeremy Holland. I've been a programmer for 25 years, using primarily Perl since 2000.