http://www.perlmonks.org?node_id=415933

kiat has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks

I'm curious about the term modern Perl. Does it refer to a way of thinking about Perl or does it refer more to changes in the syntax? From which version does Perl become modern?

Thanks and cheers.

Added: In response to Juerd's node Re: Tao Perl Ching - The Scripture of the Way of Perl

20041219 Edit by castaway: Updated title of replies to match root node

20041219 Edit by kiat: Just thought I would make it neutral.

Replies are listed 'Best First'.
Re: What is modern Perl?
by eyepopslikeamosquito (Archbishop) on Dec 19, 2004 at 03:18 UTC

    For an excellent definition of modern Perl, I'm honoured to quote the late Iain Truskett aka Spoon aka Koschei:

    Check that the tutorial uses good, modern style. 3-arg open (or at least whitespace between action and filename). Should be advocating 'use strict' and 'use warnings' (which will show it's at least 5.6 or later). Should introduce perldoc very early on. Lexical filehandles. No ampersands when calling functions in the ordinary case. /x both mentioned and advocated for regex. POD. Other stuff. And most importantly, security, including common sense and tainting.

    In "Other stuff" above, I'd include a sound Test::More-based test suite (in t/ directory) with good code coverage.

    Also, merlyn comments on a script that is not written in modern Perl style here.

    FWIW, I'd say Perl become "modern" around version 5.6, since that is the version that introduced lexical file handles, 3-argument open, and use warnings.

Re: What is modern Perl?
by Trimbach (Curate) on Dec 19, 2004 at 02:43 UTC
    In my experience "modern Perl" means "Perl 5", as opposed to Perl 4, i.e. code that uses references, OO, namespaces, etc.

    That makes Perl 6 "Post-modern Perl." :-)

    Gary Blackburn
    Trained Killer

Re: What is modern Perl?
by graff (Chancellor) on Dec 19, 2004 at 03:54 UTC
    For me, "modern Perl" refers to 5.8, with its use of utf8 internally for all character-based operations, its Encode module for inter-operating with virtually all non-Unicode character sets, and the PerlIO layers. The first two points make Perl a serious player (in fact, a tremendous asset) for dealing with human languages other than English, and PerlIO brings amazing simplicity to the scripting of some really powerful concepts.

    When I write scripts using these resources, it's hard (or scary) to imagine how I would get my work done without them.

      Yikes, I hope you don't mean 5.8.0 by that. If you are using all of those features, you want at least 5.8.4 IMO.
        No, of course not. I know there were some problems with 5.8.0 (I even discovered one or two myself), and I was deeply grateful when 5.8.1 came out; 5.8.5 is working great in production for me now.

        I was just using "5.8" as a cover term for "anything later than 5.7".

Re: What is modern Perl?
by rinceWind (Monsignor) on Dec 21, 2004 at 13:29 UTC
    I believe that the term "Modern Perl" was coined by Michael Saltzman in the title of his book Modern Perl Programming. The book is reviewed here.

    Noting when this book was published, 2002, this would suggest that version 5.6.1 would be the baseline version of modern perl. I agree with this, in that I expect modules to be supported in this version and all subsequent. This is also the version I develop on primarily, owing to platform and user base reasons. I've also not had any need to embrace i18n and utf-8 in my applications, which are the main changes in the 5.8.x stream.

    This version had "use warnings", "our" and lexical file handles, all of which I tend to make use of in my own modules.

    --
    I'm Not Just Another Perl Hacker

      Although I don't use it, I just learned that using & in calling subs is old perl.
        It isn't - it has a very specific meaning that most people don't intend. So, when they use it, it makes them look as if they coded in Perl4 where it did have the meaning most people intend.

        Being right, does not endow the right to be rude; politeness costs nothing.
        Being unknowing, is not the same as being stupid.
        Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
        Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.