34 at 34 for V5.34: Modern Perl Features for Perl’s Birthday

Friday, December 17, 2021, marked the thirty-fourth birthday of the Perl programming language, and, coincidentally, this year saw the release of version 5.34. There are plenty of Perl developers out there who haven’t kept up with recent (and not-so-recent) improvements to the language and its ecosystem, so I thought I might list a batch. You may have seen some of these before in May’s post “Perl can do that now!”

The feature Pragma

Perl v5.10 was released in December 2007, and with it came feature, a way of enabling new syntax without breaking backward compatibility. You can enable individual features by name (e.g., use feature qw(say fc); for the say and fc keywords), or by using a feature bundle based on the Perl version that introduced them. For example, the following:

A Good Old-Fashioned Perl Log Analyzer

A Good Old-Fashioned Perl Log Analyzer

A recent Lobsters post lauding the virtues of AWK reminded me that although the language is powerful and lightning-fast, I usually find myself exceeding its capabilities and reaching for Perl instead. One such application is analyzing voluminous log files such as the ones generated by this blog. Yes, WordPress has stats, but I've never let reinvention of the wheel get in the way of a good programming exercise.

So I whipped this script up on Sunday night while watching RuPaul's Drag Race reruns. It parses my Apache web server log files and reports on hits from week to week.

Regular Expressions in Python Using The re Module

What is Regex?

Regex, or a more known terminology, Regular Expressions, is used to create complex patterns for searching substring inside Strings.

We have other methods of finding substring as well, but regex can cope up with way more complicated patterns than just normal searching for a substring.

7 Coding Tools That Will Maximize Your Effectiveness

When learning to code, developers-to-be are usually taught to code vanilla software. In the workplace, however, developers use many tools to speed up their coding. Common tasks like testing, running various scripts, and programming environment control are just a few examples of when an extra tool comes in handy.

The trouble is, there are many of these tools on the market, and it’s hard to know which are best. It often takes years of trial and error to discover which tools are the most helpful. To save you that effort, we asked some experienced developers about the tools that have helped them become better coders and maximize their efficiency on the job.

Going Beyond Regular Expressions with Structural Code Search

We're introducing a new way to search code at Sourcegraph with structural code search. Structural code search lets you match nested expressions and whole code blocks that can be difficult or awkward to match using regular expressions.

What Is Structural Code Search?

Structural code search is the idea that you can search for syntactic structures in code that correspond more closely to a program's underlying concrete syntax tree (or parse tree). For example, for loops in Rust look something like this: