Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Perl Programming Upgrades

Perl 5.14 Released 187

chromatic writes "Pumpking Jesse Vincent has just released Perl 5.14, the latest stable version of the venerable Perl 5 programming language. The list of changes in Perl 5.14 includes several enhancements, including performance tuning, Unicode improvements, and updates to the core libraries and documentation. Perl 5.16 is on track for a release next April."
This discussion has been archived. No new comments can be posted.

Perl 5.14 Released

Comments Filter:
  • by cowboy76Spain ( 815442 ) on Saturday May 14, 2011 @07:10PM (#36130064)

    .... does it have any new operator? :-P

    And before you tell, it was just a joke, I know you should now add operators in a minor release.

    • by gman003 ( 1693318 ) on Saturday May 14, 2011 @07:26PM (#36130142)
      Actually, I've always thought there should be one more common operator - "===". In floating-point context, it would be "approximately equal to", returning true if the arguments are within 10 times the smallest representable value. That would reduce problems with floating-point comparison. Hell, make it work for integers too - it might be useful in PLCs and stuff.

      In a string context (in Perl, it would have to be something besides ===, but we'll get to that later), it would be "visually equal to" - any characters that are visually equal would be considered equal (useful mainly when using Unicode). So the Cyrillic "e" (0435) would be considered equal to Roman "e" (0065). I'm not sure how to handle complexities like "is the single character 'small a with macron' equal to the sequence 'small a' and 'combining diacritic macron'". We'll need a committee for that, probably. And since Perl uses different operators to determine context, we'd need something else for that. "veq", maybe?

      This would, ideally, not just be a Perl construct. I can think of a lot of higher-level languages that could use that. Python. Ruby. Lua. Stuff like that. Lower-level languages probably would be better off without it - C does not need such an operator.

      Just something I've always felt could be useful to have. Sure, there's probably some library that can do those things, but it would be nice to make things simpler.
      • This would conflict with "equality without type coercion" in Javascript and PHP.
      • bite_me() if abs($x-$y)> $epsilon;

        $t =~ tr/e/e/;
        eat_me_raw() if $t eq $s;

      • I somewhat agree, however the floating point implementations SUCK at powers of ten -- you should specify epsilon in terms of powers of two. Hell, even my correct decimal text to float/double parsing function is 8 times more complex than the same in hex Why, even C has a hex float/double literal that goes something like this:
        /[+-]?0x[0-9a-f]+\.?[0-9a-f]*p?[+-]?[0-9a-f]*/i )

        The "p" in there stands for "times Nth power of two" similar to the "e" in decimal floats meaning "times Nth power of ten". eg: 0x123p-8 == 0x1.23

        Note, hex decimal places act like decimal's do eg:
        0x1.23 == (dec) 1 + 35 / 256 == 1.13671875 or (hex) 0x1 + 0x23 / 0x100 == 0x1.23

        Specifying floats in the language of the computer's math (binary representable fractions) allows you to actually use equality properly ;-)

        Some of my languages have the === operator already, similar to JS's exact match, perhaps ~=~ or =~= or "approx" would be better?
        I've thought of adding an "approximate" operator -- esp. for physics simulation & game DSLs.

        Although, what's wrong with specifying your required precision? Define your own epsilon (error factor).

        print "$a is approx $b\n" if ( $a > ($b - $epsilon) && $a < ($b + $epsilon) );

        # Compared to:
        print "$a is approx $b\n" if ( $a approx $b );

        # Oh, great, now we need another obscure magic special variable to contain epsilon...
        # Perhaps
        would do? Our English users won't mind using character map...

      • by sqldr ( 838964 )

        Actually, I've always thought there should be one more common operator - "===". In floating-point context, it would be "approximately equal to", returning true if the arguments are within 10 times the smallest representable value.

        You can already do that in the language. More to the point, why 10 times? That's a bit decimalist isn't it? Shouldn't that be configurable, and if so, surely you would do so via a function. So now we have a function controlling the behaviour of an operator.. yuck! As for unic

      • by devent ( 1627873 )

        if ( isApproximatelyEqual(10.356, 10.356) ) { }
        if ( isVisuallyEqual('a', 'a') ) { }

        Wow that was easy. Do you have any other brilliant ideas for new operators?

    • by dorward ( 129628 )

      This is version 14 of Perl 5. It is a major release. (Perl 6 is [rakudo.org] a new language)

    • .... does it have any new operator? :-P

      Of course. Not every possible key combination has been used yet.

      With previous versions of perl, a cat could walk over the keyboard and accidentally create valid perl code.
      Now a cat walking over the keyboard will for sure create valid perl code.

      • by gman003 ( 1693318 ) on Saturday May 14, 2011 @09:07PM (#36130576)
        That reminded me of "Black Perl":

        BEFOREHAND: close door, each window & exit; wait until time.

        open spellbook, study, read (scan, select, tell us);

        write it, print the hex while each watches,

        reverse its length, write again;

        kill spiders, pop them, chop, split, kill them.

        unlink arms, shift, wait & listen (listening, wait),

        sort the flock (then, warn the "goats" & kill the "sheep");

        kill them, dump qualms, shift moralities,

        values aside, each one;

        die sheep! die to reverse the system

        you accept (reject, respect);

        next step,

        kill the next sacrifice, each sacrifice,

        wait, redo ritual until "all the spirits are pleased";

        do it ("as they say").

        do it(*everyone***must***participate***in***forbidden**s*e*x*).

        return last victim; package body;

        exit crypt (time, times & "half a time") & close it,

        select (quickly) & warn your next victim;

        AFTERWORDS: tell nobody.

        wait, wait until time;

        wait until next year, next decade;

        sleep, sleep, die yourself,

        die at last

        That's actually valid Perl (only Perl 3, though - it breaks in later versions). And yes, I'm aware most of you have already seen it.

  • Perl is alive!

    Last time I checked Slashdot still runs on perl...

    My company does too.

    Now that ActiveState is providing Perl for Cloudfoundry, it's going to be good times in Perl land.

    • Re: (Score:3, Insightful)

      by rubycodez ( 864176 )
      last time I checked the UI of Slashdot was becoming ever more bloated, ugly and less functional. They should ditch the Perl for a modern language while rewriting the whole ball of shit.
      • What does UI have have to do with the backend implementation? The UI goes in a bunch of template files, which could theoretically be language agnostic.

        Any task (with regards to web apps) a modern language can do, Perl can do (and visa versa). One may be easier than the other for certain things, but Perl isn't a choice. Maybe not the best choice, but certainly far from unusable.

  • by EEPS ( 829675 ) on Saturday May 14, 2011 @08:37PM (#36130462)
    Despite what many are saying, Perl is still used extensively even for new projects. I use it daily, and while I really like ruby and python, for a variety of reasons, I have not switch away from Perl for most projects. My only question is when will Strawberry Perl 5.14 be released?
    • by aixylinux ( 1287566 ) on Saturday May 14, 2011 @09:37PM (#36130694)

      I agree completely. As a UNIX sysadmin I frequently write scripts. For short and simple things, shell is preferred. But if I anticipate any complexity, I reach for Perl. I've had the experience of getting deeply into a shell script and thinking "I should have used Perl". Perl has never let me down, although I confess at times the programs have that write-only, line-noise appearance. But that's just because I've learned to use the idioms, and I comment on the complex stuff for the benefit of those who follow me--which could include myself six months later.

      I'd write Ruby if I could. The syntax is cleaner, and objects are built-in, not bolted on. But Ruby is just not available where I need it. Does anybody know of an AIX LPP package for Ruby?

      Also, I've been deeply disappointed at the progress of Perl 6--but Perl 5 does everything I need, so I really don't miss it. Of all sad words of tongue or pen, the saddest are these--it might have been.

      • I agree. I can always find Perl installed (most of the *nixes come with this by default due to dependencies), but python is less frequently installed, and ruby is almost never installed. Perl works fine for those hack-type scripts, so I don't see a pressing need to go start installing ruby or python everywhere. If ease of use is the deciding factor for choosing the language, then Perl is certainly the easiest to deploy of the full fledged scripting languages.

  • I see dead languages, languishing in the default installs of OS mostly as wrappers for menial tasks, taking command line arguments and making output in some cron and admin jobs, and they don't even know that they're dead! 8o

  • by shutdown -p now ( 807394 ) on Saturday May 14, 2011 @11:22PM (#36131070) Journal

    A more readable changelog, with formatting, hyperlinks etc applied (rather than a raw pod file) can be seen here [cpan.org]

  • by Tumbleweed ( 3706 ) * on Sunday May 15, 2011 @12:38AM (#36131370)

    Internet Yiddish LIVES!

  • There are some really good changes going into 5.14. Worth highlighting for anyone with Perl experience.

    The Array/Hash reference mess has been greatly improved. You can now perform [cpan.org] most builtin operations directly on array references. So no need to mess around with dereferencing things all over the place. This is a huge improvement in the syntax surrounding complex data structures.

    The eval exception handling mess has been cleaned up so that error handling modules such as autodie [cpan.org] can function properly

A committee takes root and grows, it flowers, wilts and dies, scattering the seed from which other committees will bloom. -- Parkinson

Working...