Perl 5.10 (35)

1 Name: #!/usr/bin/anonymous : 2008-01-06 12:43 ID:MsIHNvK+

http://search.cpan.org/perldoc?perl5100delta

Has anyone played with these new features? I personally haven't touched Perl in years. Python and Ruby have superseded it entirely for me.

I noticed 5.10 adopted Python's named regex captures, which made me laugh. They seem to have finally added some form of switch statement, too... never mind that people have been asking for that one since what, Perl 4? Although they're being strangely careful about not calling it "switch". Maybe because for all this time they've insisted that anything you want to do with switch can be done just as easily with a chain of && and || or a mess of if/else blocks.

The two things I really don't get at all are the //= operator (what exactly does it do that ||= doesn't?) and that ~~ thing that apparently is like the switch without the switch clause. (When would it ever have been useful to put a random case statement in the middle of a block of C code, I don't know.)

The file test operator stacking looks useful: if (-r -w -x $filename) instead of if (-r $filename && -w $filename && -x $filename). Although I suspect it may be partly because some perl developer wanted to improve his golf score.

There's a couple bits on the change log that just bewilder me, though.

> Sorting arrays in place (@a = sort @a) is now optimized to avoid making a temporary copy of the array.
> Likewise, reverse sort ... is now optimized to sort in reverse, avoiding the generation of a temporary intermediate list.

I'm honestly surprised that those weren't done ten years ago. Especially the first bit.

And then there's this, which just made me wtflol:

> Traditionally, eval 'syntax error' has leaked badly. Many (but not all) of these leaks have now been eliminated or reduced. (Dave Mitchell)

Traditionally, Perl leaked.

This thread has been closed. You cannot post in this thread any longer.