January 2022 Archives

My Favorite Warnings: precedence

Perl possesses a rich and expressive set of operators. So rich, in fact, that other adjectives can come to mind, such as prolix, or even Byzantine.

Requests for help navigating Perl's operator space appear repeatedly on outlets such as PerlMonks. These seem to me to involve two sorts of confusion: precedence (discussed here) and functionality (string versus numeric -- maybe another blog post).

The precedence warnings ca…

My Favorite Warnings: qw

When I first came to Perl I thought the qw{} construction was pretty neat. Give it a bunch of white-space-delimited text and it gives you back a list separated on the blanks. So

say for qw{ Fee fie foe fum! };

prints 'Fee', 'fie', 'foe', and 'fum!', each on its own line. But if you add punctuation, and warnings are enabled,

say for qw{ Fee, fie, foe, fum! };

gets you ="prettyp…

Do-It-Yourself warnings categories

One of the reasons I have not "moved on" from Perl to some other more "modern" language is that Perl gives me such great access to its inner workings. The Do-It-Yourself Lexical Pragmas post from a couple weeks ago is an example of this. Another example is that Perl lets you tie your own code into its warnings system.

Tying into the warnings machinery requires a module. Tha…

My Favorite Warnings: closure

In the context of Perl, a closure is a piece of code that captures a specific instance of a lexical variable. A blog entry a month or so ago explores this in greater detail. If you review this blog entry, though, note that it does not cover lexical subroutines, which act more like anonymous subroutines even though they are named.

This blog entry, though, covers the closure/users/tom_wyant/2022/01/index.html

About Tom Wyant

user-pic I blog about Perl.