hillu
hillu

Reputation: 9611

What are the most interesting/useful new things in Perl 5.12?

I remember quickly adopting given .. when, say, //, and the smart matching operator when Perl 5.10 came around.

What do you consider the most useful fixes and features introduced with Perl 5.12.0?

Upvotes: 5

Views: 642

Answers (5)

Adam Kennedy
Adam Kennedy

Reputation: 1612

There's some subtle but non-trivial improvements that will make Portable (flash drive) Perl distributions work better (or at all).

Perl also now has support for 64-bit on Windows with GCC, so Strawberry Perl 64-bit should come out soon.

Upvotes: 3

tsee
tsee

Reputation: 5072

This is my favourite feature by far:

use 5.012; # enables 'use strict' implicitly!

Upvotes: 5

DVK
DVK

Reputation: 129403

Raw data:

Interesting:

Wonderful:

Not sure if any of the info is new, but perlperf - Perl Performance and Optimization Techniques was added to documentation!!!

Useful:

Upvotes: 6

Brad Gilbert
Brad Gilbert

Reputation: 34120

while( readdir $dir ){} now works a lot more like while( readline $file ){}.

perl -MO=Deparse -e'while( readline $f ){}'
while (defined($_ = <$f>)) {
    ();
}

<$f> is the same as readline $f


This is how Perl versions prior to v5.11.2 have been handling while( readdir $dir ){}

perl-5.10 -MO=Deparse -e'while( readdir $d ){}'
while (readdir $d) {
    ();
}

It is worth noting that the above will fail to work correctly if there is a file, or directory with the name of 0. Which doesn't matter that much since it doesn't do anything useful anyway.


In Perl version 5.11.2 there was a patch added that brought it more into line with the handling of while( readline $file ){...}.

perl-5.12.0 -MO=Deparse -e'while( readdir $d ){}'
while (defined($_ = readdir $d)) {
    ();
}

I would like to note that I was the one who provided that patch. It was the first thing I have ever tried to fix in the Perl core. So it was also the first patch I wrote, that made it into Perl.

Upvotes: 6

Quentin
Quentin

Reputation: 943556

I like the idea of Yada Yada, although time will tell if it is actually useful.

Upvotes: 3

Related Questions