Perl v5.16 now sets proper magic on lexical $_

[Lexical $_ was removed in v5.24]

Perl v5.10 introduced given and the lexical $_. That use of $_, which everyone has assumed is a global variable, turned out to be a huge mistake. The various bookkeeping on the global version didn’t happen with the lexical version, so strange things happened. Continue reading “Perl v5.16 now sets proper magic on lexical $_”

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 successful pattern match with captures: Continue reading “Perl v5.20 fixes taint problems with locale”

Use postfix dereferencing

[Update: This feature became 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 undocumented in the pragma docs) (Item 2. Enable new Perl features when you need them. and turn off the experimental warnings: Continue reading “Use postfix dereferencing”

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 a problem with perl since it’s relied on the underlying libc for so much. Continue reading “Perl 5.20 uses its own random number generator”

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 from CPAN. For Windows, Strawberry Perl 5.20 is available now. The full details are in the perldelta Continue reading “Perl 5.20 new features”