Category Archives: 5.20

Use v5.20 subroutine signatures

Subroutine signatures, in a rudimentary form, have shown up in Perl v5.20 as an experimental feature. After a few of years of debate and a couple of competing implementations, we have something we can use. And, because it was such a contentious subject, it got the attention a new feature deserves. They don’t have all […]

Perl v5.20 fixes taint problems with locale

Perl v5.20 fixes taint checking in regular expressions that might use the locale in its pattern, even if that part of the pattern isn’t a successful part of the match. The perlsec documentation has noted that taint-checking did that, but until v5.20, it didn’t. The only approved way to untaint a variable is through a […]

Use postfix dereferencing

[Update: This feature becomes stable in Perl v5.24] Perl v5.20 offers an experimental form of dereferencing. Instead of the complicated way I’ll explain in the moment, the new postfix turns a reference into it’s contents. Since this is a new feature, you need to pull it in with the feature pragma (although this feature in […]

Perl v5.20 combines multiple my() statements

Perl v5.20 continues to clean up and optimize its internals. Now perl optimizes a series of lexical variable declarations into a single list declaration.

In v5.20, -F implies -a implies -n

Perl was once known for its one-liners in its sysadmin heydays. People would pass around lists of these one liners, many of which replaced complicated pipelines that glued together various unix utilities to do some impressive system maintenance.

Perl 5.20 introduces “Key/Value Slices”

Perl v5.20 adds the “Key/Value Slice”, which extracts multiple keys and their corresponding values from a container (hash or array). It uses the %, which is new, legal syntax for a variable name with subscripts after it:

Perl 5.20 optimizes return at the end of a subroutine

Want to save 10 nanoseconds? Perl v5.20 optimizes a return at the end of a subroutine to use two fewer ops in the optimized version. During compilation, a subroutine like this one:

Perl 5.20 uses its own random number generator

Prior to v5.20, perl used whatever random number generator the system provided. This meant that the same program could have statistically different results based on the quality of that function. The rand() for Windows had a max of 32,768 (15 bits), while POSIX has drand48 (48 bits). This sort of numerical un-portability has always been […]

Perl 5.20 new features

Perl 5.20 is out and there are some nice syntax changes that make life easier for Perlers, along with some improvements that don’t require any work from you. Some of the features are experimental, so be careful that you don’t create problems by overusing them until they settle down. You can download the Perl source […]